finitio 0.6.0 → 0.6.1

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: 2a0323f2adb7a1633153813167df123264370f86
4
- data.tar.gz: 610d4134c0eb64b1b3b2c1b525ed70a87a86d2df
3
+ metadata.gz: b96114d305e1a1028b5928cb419060c63e5385b0
4
+ data.tar.gz: a7630a2f60f26888e217113bc701222ff0822f45
5
5
  SHA512:
6
- metadata.gz: 67d9b094d0f0b18ace3261583232c560ef696d13d5651a378b7c84b938a9c4e253b29804c151ac7eb2c7a5e2ef933fae4372bec8e2c48439a99041e1894d346c
7
- data.tar.gz: e4bfed73b3a3921cb288a0f43fd3109f1ba0afeecdfd8549d5c2e3aff4349fe7aef946e1511d79ffe023151af64bc5cc51127ec97f8d91443b60dc502ddf2d50
6
+ metadata.gz: 52b4db3b9a8d266b016ae992f8ce36113aaffb1c8468bc89f4468e92b6871db63ab59b7a5e6371b931c6074fb7d44bce438215280a25d4a71a632ed8fa7fde94
7
+ data.tar.gz: 4628099b4394f0fab3d064265193b022565b6393c8278fe8f3ca02b3c8f6ba0dfe95bf690e9dbb260eb5fe121820b15e03b7df82ae41e16aca4a85b62c38bae0
@@ -1,3 +1,8 @@
1
+ # 0.6.1 / 2018-03-23
2
+
3
+ * Fix support for typed extra attributes, a KeyError was raised when
4
+ keys were Symbols and not Strings.
5
+
1
6
  # 0.6.0 / 2018-02-17
2
7
 
3
8
  * Add support for typed extra attributes, e.g. { ...: Integer }
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- finitio (0.6.0)
4
+ finitio (0.6.1)
5
5
  citrus (>= 2.4, < 4.0)
6
6
 
7
7
  GEM
@@ -42,7 +42,8 @@ module Finitio
42
42
  else
43
43
  extra.each do |attr|
44
44
  handler.deeper(attr) do
45
- uped[attr.to_sym] = extra_type.dress(value.fetch(attr), handler)
45
+ attr_value = value.fetch(attr){|k| value.fetch(attr.to_sym) }
46
+ uped[attr.to_sym] = extra_type.dress(attr_value, handler)
46
47
  end
47
48
  end
48
49
  end
@@ -3,7 +3,7 @@ module Finitio
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 6
6
- TINY = 0
6
+ TINY = 1
7
7
 
8
8
  def self.to_s
9
9
  [ MAJOR, MINOR, TINY ].join('.')
@@ -27,6 +27,16 @@ module Finitio
27
27
  end
28
28
  end
29
29
 
30
+ context 'with a valid Hash with Symbol keys' do
31
+ let(:arg){
32
+ { r: 12, g: 13, b: 255 }
33
+ }
34
+
35
+ it 'should coerce to a tuple' do
36
+ expect(subject).to eq(r: 12, g: 13, b: 255)
37
+ end
38
+ end
39
+
30
40
  context 'with a valid Hash and no optional' do
31
41
  let(:arg){
32
42
  { "r" => 12, "g" => 13 }
@@ -174,6 +184,20 @@ module Finitio
174
184
  expect(subject).to eq(r: 12, g: 13, extr: -165)
175
185
  end
176
186
  end
187
+
188
+ context 'with a valid extra attribute and Symbol keys' do
189
+ let(:arg){
190
+ { r: 12, g: 13, extr: -165 }
191
+ }
192
+
193
+ it 'should not raise a TypeError' do
194
+ expect(subject).not_to be_a(TypeError)
195
+ end
196
+
197
+ it 'should return a coerced/projection' do
198
+ expect(subject).to eq(r: 12, g: 13, extr: -165)
199
+ end
200
+ end
177
201
  end
178
202
 
179
203
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finitio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-17 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: citrus