abstractivator 0.0.18 → 0.0.19

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: d228a0ed6f537d3f752f6a46912bad4619047db0
4
- data.tar.gz: 4d304955258c6138dc8eddd7a7d9dc716b39ce1d
3
+ metadata.gz: 3e4b42be94b67b4941fa92b59dde30b82f7f5621
4
+ data.tar.gz: 60fbb6aef6b5e1d5b238e5b25b93e555f19d0de7
5
5
  SHA512:
6
- metadata.gz: e48954a97bf6a2d352f952709df932497688d2360d68d4531dac5ca44540b02322d0b21ab0626ad05cf38ea22a60c1af49102eed5e4d3c2bac24d84b9f74c4ff
7
- data.tar.gz: 573161dc96da1502eceed8bb3a17f7877384521a1756b390ba2a21ec17d60655dfc1bb22b7135add3748af38f66c98f8147e45584b6968e18f49e7d724fcddb6
6
+ metadata.gz: 52b1865dd2933ca08c785188be8efa59d284bff6e2e965138b25fcefd42309ce3d6cc16913a059dcc4c4470077631e5be9d01514b1251f96d27c9bdbadef1ee9
7
+ data.tar.gz: 4e98f6f9f0e31efb1b1445b0aa6f7a299780b99581679a8019a2a295098b9c5a99792c62c3fecf1d2b9d7865fc3351496f987912f2918855501816f80ff97ca5
@@ -8,4 +8,10 @@ class Array
8
8
  size == 2 or raise 'array must contain exactly two elements'
9
9
  last
10
10
  end
11
+
12
+ unless instance_methods.include?(:to_h)
13
+ define_method(:to_h) do
14
+ Hash[self]
15
+ end
16
+ end
11
17
  end
@@ -1,3 +1,3 @@
1
1
  module Abstractivator
2
- VERSION = '0.0.18'
2
+ VERSION = '0.0.19'
3
3
  end
@@ -21,4 +21,10 @@ describe Array do
21
21
  expect{[:k, :v, :z].value}.to raise_error
22
22
  end
23
23
  end
24
+
25
+ describe '#to_h' do
26
+ it 'makes a hash out of an array of pairs' do
27
+ expect([[:a, 1], [:b, 2]].to_h).to eql({a: 1, b: 2})
28
+ end
29
+ end
24
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstractivator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Winton