dry-types 0.9.1 → 0.9.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 +12 -0
- data/lib/dry/types/coercions/form.rb +2 -2
- data/lib/dry/types/definition.rb +2 -2
- data/lib/dry/types/hash/schema.rb +6 -2
- data/lib/dry/types/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: a297bd87145c7fe1400121a10e4a1909c70248a2
|
4
|
+
data.tar.gz: 6de4360daa4b430468a47ab49473536075a4da7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb09ba97edd602648519073dac33d3cf4044fe28745ae42f384e37ec40ec9649f0a140b76fddbc04adc661fe34512b6cfad6d638cc633231fcb58be72207dd9a
|
7
|
+
data.tar.gz: a73f58d044ed8c05aa820c86350bd3ae08a9ed93d838ef13c7fbb5b726579d9d268371e3d2a5d467b549d905761d9cdb136818c030d57eb2d55b06aab3f7bd11
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# v0.9.2 to-be-released
|
2
|
+
|
3
|
+
## Added
|
4
|
+
|
5
|
+
* Support for `"Y"` and `"N"` as `true` and `false` values, respectively (scare21410)
|
6
|
+
|
7
|
+
## Changed
|
8
|
+
|
9
|
+
* Optimized object allocation in hash schemas, resulting in up to 25% speed boost (davydovanton)
|
10
|
+
|
11
|
+
[Compare v0.9.1...v0.9.2](https://github.com/dryrb/dry-types/compare/v0.9.1...v0.9.2)
|
12
|
+
|
1
13
|
# v0.9.1 2016-11-04
|
2
14
|
|
3
15
|
## Fixed
|
@@ -5,8 +5,8 @@ module Dry
|
|
5
5
|
module Types
|
6
6
|
module Coercions
|
7
7
|
module Form
|
8
|
-
TRUE_VALUES = %w[1 on On ON t true True TRUE T y yes Yes YES].freeze
|
9
|
-
FALSE_VALUES = %w[0 off Off OFF f false False FALSE F n no No NO].freeze
|
8
|
+
TRUE_VALUES = %w[1 on On ON t true True TRUE T y yes Yes YES Y].freeze
|
9
|
+
FALSE_VALUES = %w[0 off Off OFF f false False FALSE F n no No NO N].freeze
|
10
10
|
BOOLEAN_MAP = ::Hash[TRUE_VALUES.product([true]) + FALSE_VALUES.product([false])].freeze
|
11
11
|
|
12
12
|
extend Coercions
|
data/lib/dry/types/definition.rb
CHANGED
@@ -57,13 +57,15 @@ module Dry
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def resolve(hash)
|
60
|
-
|
60
|
+
result = {}
|
61
|
+
member_types.each do |key, type|
|
61
62
|
if hash.key?(key)
|
62
63
|
result[key] = yield(type, key, hash[key])
|
63
64
|
else
|
64
65
|
resolve_missing_value(result, key, type)
|
65
66
|
end
|
66
67
|
end
|
68
|
+
result
|
67
69
|
end
|
68
70
|
|
69
71
|
def resolve_missing_value(result, key, type)
|
@@ -133,7 +135,8 @@ module Dry
|
|
133
135
|
private
|
134
136
|
|
135
137
|
def resolve(hash)
|
136
|
-
|
138
|
+
result = {}
|
139
|
+
member_types.each do |key, type|
|
137
140
|
keyname =
|
138
141
|
if hash.key?(key)
|
139
142
|
key
|
@@ -147,6 +150,7 @@ module Dry
|
|
147
150
|
resolve_missing_value(result, key, type)
|
148
151
|
end
|
149
152
|
end
|
153
|
+
result
|
150
154
|
end
|
151
155
|
end
|
152
156
|
|
data/lib/dry/types/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|