typecast 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/type_cast/version.rb +1 -1
- data/lib/type_cast.rb +1 -1
- data/spec/customer_spec.rb +4 -0
- data/spec/support/customer.rb +1 -1
- data/spec/support/user.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ab8f1650d1e14de428e215bf8c11c26738eae07
|
4
|
+
data.tar.gz: fb46b3866ea380cb935c9109c4348e7e12150a1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf81694ebce5752c7d31a114238a94b3f5d0636f6ea8dd1f75a715b9f6eca7c225f94e450bcf09c10d5b3b61ed0528aaee97d21b8627744392b8056e894af6b
|
7
|
+
data.tar.gz: 8d740bf2c55fe09af27432a73cce9ad4f8910c1f16741bb59765fff5ebf2f0a947df832754f362148b45ea8dfdbb5ac2171020a6a9fa0251245f34b283614235
|
data/README.md
CHANGED
data/lib/type_cast/version.rb
CHANGED
data/lib/type_cast.rb
CHANGED
@@ -48,7 +48,7 @@ module TypeCast
|
|
48
48
|
method_missing(:#{attribute})
|
49
49
|
end
|
50
50
|
self.#{attribute}_before_type_cast = uncasted
|
51
|
-
if uncasted.
|
51
|
+
if uncasted.respond_to?(:#{conversion_method})
|
52
52
|
uncasted.__send__(:#{conversion_method})
|
53
53
|
else
|
54
54
|
uncasted
|
data/spec/customer_spec.rb
CHANGED
@@ -33,4 +33,8 @@ describe Customer do
|
|
33
33
|
expect(subject.created_at_before_type_cast).to eq "2014-05-26T19:31:04+03:00"
|
34
34
|
expect(subject.dynamic_created_at_before_type_cast).to eq "2014-05-27T13:19:25+03:00"
|
35
35
|
end
|
36
|
+
|
37
|
+
it "performs type casting of any value (not only String) if provided method name for type cast" do
|
38
|
+
expect(subject.suggestions_count).to eq 0
|
39
|
+
end
|
36
40
|
end
|
data/spec/support/customer.rb
CHANGED
data/spec/support/user.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Avoyants
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|