rom 3.3.2 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/rom/types.rb +16 -23
- data/lib/rom/version.rb +1 -1
- 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: 6668c7efb86e5ea164b03271cedf244574e9bde7
|
4
|
+
data.tar.gz: 2a7403db878177957d12db58803a0e8acda09fea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dc7c86d402ca351d91da62a1c4b2d24ce2f0b9203ed021ebe5a80943e9c0ad145b85502ec3b787d99f98793ba9488a726586f9523b9cbc0d7ec84e40e81450d
|
7
|
+
data.tar.gz: 6effb40c6e224f3a9eb398bff9a984b521559dbbb3103b3d3c7f389d367e3e8b45f0f68657a546fcc98ce09ba2fe63de59cd11e0172a92dac49ce4dcf7140856
|
data/CHANGELOG.md
CHANGED
data/lib/rom/types.rb
CHANGED
@@ -7,10 +7,6 @@ module ROM
|
|
7
7
|
|
8
8
|
def self.included(other)
|
9
9
|
other.extend(Methods)
|
10
|
-
other::Coercible.extend(CoercibleMethods)
|
11
|
-
other::Coercible.const_set('JSON', other::Coercible.JSON)
|
12
|
-
other::Coercible.const_set('JSONHash', other::Coercible.JSONHash)
|
13
|
-
other::Coercible.const_set('HashJSON', other::Coercible.HashJSON)
|
14
10
|
super
|
15
11
|
end
|
16
12
|
|
@@ -28,29 +24,26 @@ module ROM
|
|
28
24
|
end
|
29
25
|
end
|
30
26
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
::JSON.parse(value.to_s, symbolize_names: symbol_keys)
|
38
|
-
rescue ::JSON::ParserError
|
39
|
-
value
|
40
|
-
end
|
27
|
+
def Coercible.JSONHash(symbol_keys: false, type: Types::Hash)
|
28
|
+
Types.Constructor(type) do |value|
|
29
|
+
begin
|
30
|
+
::JSON.parse(value.to_s, symbolize_names: symbol_keys)
|
31
|
+
rescue ::JSON::ParserError
|
32
|
+
value
|
41
33
|
end
|
42
34
|
end
|
35
|
+
end
|
43
36
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
::JSON.dump(value)
|
48
|
-
end
|
49
|
-
end
|
37
|
+
def Coercible.HashJSON(type: Types::String)
|
38
|
+
Types.Constructor(type) { |value| ::JSON.dump(value) }
|
39
|
+
end
|
50
40
|
|
51
|
-
|
52
|
-
|
53
|
-
end
|
41
|
+
def Coercible.JSON(symbol_keys: false)
|
42
|
+
self.HashJSON.meta(read: self.JSONHash(symbol_keys: symbol_keys))
|
54
43
|
end
|
44
|
+
|
45
|
+
Coercible::JSON = Coercible.JSON
|
46
|
+
Coercible::JSONHash = Coercible.JSONHash
|
47
|
+
Coercible::HashJSON = Coercible.HashJSON
|
55
48
|
end
|
56
49
|
end
|
data/lib/rom/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|