nested-hstore 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nested_hstore/serializer.rb +11 -7
- data/lib/nested_hstore/version.rb +1 -1
- metadata +2 -2
@@ -6,7 +6,6 @@ module NestedHstore
|
|
6
6
|
@types_map = {
|
7
7
|
array: '__ARRAY__',
|
8
8
|
float: '__FLOAT__',
|
9
|
-
hash: '__HASH__',
|
10
9
|
integer: '__INTEGER__',
|
11
10
|
string: '__STRING__'
|
12
11
|
}
|
@@ -47,15 +46,15 @@ module NestedHstore
|
|
47
46
|
hash.values.map { |v| decode_json_if_json(v) }
|
48
47
|
when :float
|
49
48
|
hash[@value_key].to_f
|
50
|
-
when :hash
|
51
|
-
hash.each do |k, v|
|
52
|
-
hash[k] = decode_json_if_json(v)
|
53
|
-
end
|
54
|
-
hash
|
55
49
|
when :integer
|
56
50
|
hash[@value_key].to_i
|
57
51
|
when :string
|
58
52
|
hash[@value_key]
|
53
|
+
else
|
54
|
+
hash.each do |k, v|
|
55
|
+
hash[k] = decode_json_if_json(v)
|
56
|
+
end
|
57
|
+
hash
|
59
58
|
end
|
60
59
|
deserialized
|
61
60
|
end
|
@@ -73,7 +72,12 @@ module NestedHstore
|
|
73
72
|
hstore[k] = v.to_s
|
74
73
|
end
|
75
74
|
end
|
76
|
-
|
75
|
+
|
76
|
+
if type != :hash
|
77
|
+
hstore.merge!(@type_key => @types_map[type])
|
78
|
+
end
|
79
|
+
|
80
|
+
hstore
|
77
81
|
end
|
78
82
|
|
79
83
|
def standardize_value(value)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested-hstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|