dynamini 2.9.3 → 2.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dynamini.gemspec +1 -1
- data/lib/dynamini/type_handler.rb +9 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebd0e269336c9f95ef216c388e639937d4521d48
|
4
|
+
data.tar.gz: 0e88fb606a0c2a40f12c9895b578e3de70e51ada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7d3fb89285521304043e7ccbd302d16621dfaf0202117cba4d79df46cf5c3335bb83e0c49740e11dd268a95d679d804f9b0e2455c19445d282658f2b33b111f
|
7
|
+
data.tar.gz: 0151358e63ad145f0c672355165c7c272992743960c9786b098bda3d9f64415a3aae9a568229dd2aee42a12a2f0fd00117c80872b2b05b029c12d059a86edcc8
|
data/dynamini.gemspec
CHANGED
@@ -4,7 +4,7 @@ module Dynamini
|
|
4
4
|
module TypeHandler
|
5
5
|
|
6
6
|
GETTER_PROCS = {
|
7
|
-
integer: proc { |v| v
|
7
|
+
integer: proc { |v| v.to_i if v },
|
8
8
|
date: proc do |v|
|
9
9
|
if v.is_a?(Date)
|
10
10
|
v
|
@@ -17,22 +17,22 @@ module Dynamini
|
|
17
17
|
Time.methods.include?(:zone) ? Time.zone.at(v.to_f) : Time.at(v.to_f)
|
18
18
|
end
|
19
19
|
end,
|
20
|
-
float: proc { |v| v
|
21
|
-
symbol: proc { |v| v
|
22
|
-
string: proc { |v| v
|
20
|
+
float: proc { |v| v.to_f if v },
|
21
|
+
symbol: proc { |v| v.to_sym if v },
|
22
|
+
string: proc { |v| v.to_s if v },
|
23
23
|
boolean: proc { |v| v },
|
24
24
|
array: proc { |v| v.is_a?(Enumerable) ? v.to_a : [v] },
|
25
25
|
set: proc { |v| v.is_a?(Enumerable) ? Set.new(v) : Set.new([v]) }
|
26
26
|
}.freeze
|
27
27
|
|
28
28
|
SETTER_PROCS = {
|
29
|
-
integer: proc { |v| v
|
29
|
+
integer: proc { |v| v.to_i if v },
|
30
30
|
time: proc { |v| (v.is_a?(Date) ? v.to_time : v).to_f },
|
31
|
-
float: proc { |v| v
|
32
|
-
symbol: proc { |v| v
|
33
|
-
string: proc { |v| v
|
31
|
+
float: proc { |v| v.to_f if v },
|
32
|
+
symbol: proc { |v| v.to_s if v },
|
33
|
+
string: proc { |v| v.to_s if v },
|
34
34
|
boolean: proc { |v| v },
|
35
|
-
date: proc { |v| v
|
35
|
+
date: proc { |v| v.to_time.to_f if v },
|
36
36
|
array: proc { |v| v.is_a?(Enumerable) ? v.to_a : [v] },
|
37
37
|
set: proc { |v| v.is_a?(Enumerable) ? Set.new(v) : Set.new([v]) }
|
38
38
|
}.freeze
|