super_serialize 0.0.7 → 0.0.8
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/lib/super_serialize/version.rb +1 -1
- data/lib/super_serialize.rb +3 -2
- 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: c845b46dfc0d04532239e05687b35e7a801670b7
|
4
|
+
data.tar.gz: 32a7d0be062f79ef35ec5f54d1792beae5897a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1707c7fec3e2e20b5ab4ea11898c74f989e9064456704b3521b4e3a9b8ba22d940f403a78cdda70308e2c6f2ba960cd2a597dabfaf485553092443ba5a8be01
|
7
|
+
data.tar.gz: fe4464fbecce39117023a0c286ed3b5a0728db8a4b96062d6403b116340fdfc3e4a8b64bbae634fdb22e45afbc0bde67041cd5c0aa18990f9218987239b7fdef
|
data/lib/super_serialize.rb
CHANGED
@@ -222,7 +222,7 @@ module SuperSerialize
|
|
222
222
|
|
223
223
|
def trying_to_serialize_a_hash?(value)
|
224
224
|
return false unless value.is_a?(String)
|
225
|
-
!!(value =~
|
225
|
+
!!(value =~ /\A{.+|.+}\Z/)
|
226
226
|
end
|
227
227
|
|
228
228
|
def attempt_to_sanitize_hash_syntax(value)
|
@@ -240,7 +240,8 @@ module SuperSerialize
|
|
240
240
|
|
241
241
|
def super_serialized_attr_as_string_or_yaml(attr_name)
|
242
242
|
if read_attribute(attr_name).is_a?(String)
|
243
|
-
read_attribute(attr_name)
|
243
|
+
value = read_attribute(attr_name)
|
244
|
+
trying_to_serialize_a_hash?(value) ? value : value.to_yaml
|
244
245
|
else
|
245
246
|
send(attr_name).to_yaml
|
246
247
|
end
|