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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/finitio/type/hash_based_type.rb +2 -1
- data/lib/finitio/version.rb +1 -1
- data/spec/type/multi_tuple_type/test_dress.rb +24 -0
- 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: b96114d305e1a1028b5928cb419060c63e5385b0
|
4
|
+
data.tar.gz: a7630a2f60f26888e217113bc701222ff0822f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b4db3b9a8d266b016ae992f8ce36113aaffb1c8468bc89f4468e92b6871db63ab59b7a5e6371b931c6074fb7d44bce438215280a25d4a71a632ed8fa7fde94
|
7
|
+
data.tar.gz: 4628099b4394f0fab3d064265193b022565b6393c8278fe8f3ca02b3c8f6ba0dfe95bf690e9dbb260eb5fe121820b15e03b7df82ae41e16aca4a85b62c38bae0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -42,7 +42,8 @@ module Finitio
|
|
42
42
|
else
|
43
43
|
extra.each do |attr|
|
44
44
|
handler.deeper(attr) do
|
45
|
-
|
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
|
data/lib/finitio/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citrus
|