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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3769deb85db43c5a35a186e131b43e482d3aca47
4
- data.tar.gz: a40d26e91c003cc11e26450b7401890fff58bb04
3
+ metadata.gz: a297bd87145c7fe1400121a10e4a1909c70248a2
4
+ data.tar.gz: 6de4360daa4b430468a47ab49473536075a4da7d
5
5
  SHA512:
6
- metadata.gz: d33ad6f4aba33825db679604d03243f9f6d99800992f5653643931482bf94d103cbb1ea9d4d9a35a5a50c2e65070851d5db0b95c185e0a00e3f57ba7ba15b493
7
- data.tar.gz: 67927224de5d07c3af12d8237f5ce6f05633a2aa602672198c3cef7f76eb0fd76d382c60ab33a1ad1f199ae03a0e795ee8f4b9ecdc1cd82da75ce4626a543396
6
+ metadata.gz: eb09ba97edd602648519073dac33d3cf4044fe28745ae42f384e37ec40ec9649f0a140b76fddbc04adc661fe34512b6cfad6d638cc633231fcb58be72207dd9a
7
+ data.tar.gz: a73f58d044ed8c05aa820c86350bd3ae08a9ed93d838ef13c7fbb5b726579d9d268371e3d2a5d467b549d905761d9cdb136818c030d57eb2d55b06aab3f7bd11
@@ -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
@@ -56,11 +56,11 @@ module Dry
56
56
  end
57
57
 
58
58
  def success(*args)
59
- result(Result::Success, *args)
59
+ Result::Success.new(*args)
60
60
  end
61
61
 
62
62
  def failure(*args)
63
- result(Result::Failure, *args)
63
+ Result::Failure.new(*args)
64
64
  end
65
65
 
66
66
  def result(klass, *args)
@@ -57,13 +57,15 @@ module Dry
57
57
  end
58
58
 
59
59
  def resolve(hash)
60
- member_types.each_with_object({}) do |(key, type), result|
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
- member_types.each_with_object({}) do |(key, type), result|
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
 
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Types
3
- VERSION = '0.9.1'.freeze
3
+ VERSION = '0.9.2'.freeze
4
4
  end
5
5
  end
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.1
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-04 00:00:00.000000000 Z
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby