virtus2 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +3 -0
- data/lib/virtus/attribute/coercer.rb +2 -1
- data/lib/virtus/attribute/enum.rb +0 -4
- data/lib/virtus/attribute/hash.rb +3 -2
- data/lib/virtus/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 841ced82c04c9a17b904f15c9afbbe0ef833cea1a50b321adfdd613d146591e6
|
4
|
+
data.tar.gz: 24d8f67f1abdaa6a63b5b6e04a2088ce4ed55c1f37e63492ca4029a790f17e8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77845a42756aa354f217ec353a422733121c13b3cada94d96b17576cabc2344980916933987338a4d7981f71e03483ef34a718a183eed54129e0acde47228b33
|
7
|
+
data.tar.gz: 0abf44bdcc8e443b8e86db4643e36c52d490f1fc5a7200b8683b0f1d0ab85f4ce5f5d4848e489855b0e6100dbb4355cdc2b0e2fb9b8fc6513d2fbf7e4c9b8c42
|
data/Changelog.md
CHANGED
@@ -29,7 +29,8 @@ module Virtus
|
|
29
29
|
#
|
30
30
|
# @api private
|
31
31
|
def call(value)
|
32
|
-
|
32
|
+
call_method = (method == :to_hash && value.kind_of?(Hash)) ? :itself : method
|
33
|
+
coercers[value.class].public_send(call_method, value)
|
33
34
|
rescue ::Coercible::UnsupportedCoercion
|
34
35
|
value
|
35
36
|
end
|
@@ -101,12 +101,13 @@ module Virtus
|
|
101
101
|
# @see [Attribute#coerce]
|
102
102
|
#
|
103
103
|
# @api public
|
104
|
-
def coerce(
|
104
|
+
def coerce(input)
|
105
105
|
coerced = super
|
106
|
+
klass = input.kind_of?(::Hash) ? input.class : ::Hash
|
106
107
|
|
107
108
|
return coerced unless coerced.respond_to?(:each_with_object)
|
108
109
|
|
109
|
-
coerced.each_with_object(
|
110
|
+
coerced.each_with_object(klass.new) do |(key, value), hash|
|
110
111
|
hash[key_type.coerce(key)] = value_type.coerce(value)
|
111
112
|
end
|
112
113
|
end
|
data/lib/virtus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virtus2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-09-
|
12
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: descendants_tracker
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
- !ruby/object:Gem::Version
|
219
219
|
version: '0'
|
220
220
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
221
|
+
rubygems_version: 3.0.9
|
222
222
|
signing_key:
|
223
223
|
specification_version: 4
|
224
224
|
summary: Attributes on Steroids for Plain Old Ruby Objects
|