hash-pipe 0.3.0 → 0.4.0

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: 97c6b82f6891f63b2ebe99e853caad3ed0f9dba3
4
- data.tar.gz: 2c3902d25d5e59190851df564ffccf96072ae411
3
+ metadata.gz: 47429291152be5977b3f75ca86f796291af0959e
4
+ data.tar.gz: 848520e03e0b4bfe76059b01246c52d9fbb1bea6
5
5
  SHA512:
6
- metadata.gz: b5b28216f53590f935ddb234de702ab5cb9b59c77ad50ccb0721981fd464122bea77adfa39fc40323116faeade97f052c5a8d9c56ddcb49670cfbd4a1f211648
7
- data.tar.gz: eb0caa24de4e4da80bc3674cb56ba8126ffe9a43a3dc7b44f777cad650c441a4ccbe5ffff9dfb73da596e570cd6e6c0146d822fbbc7565d82a72e5f87dff52de
6
+ metadata.gz: 443665c5461fec98e92e0eb9c91513935679980e56939396d0e0ae933826a5a36aca87fd38478d5eb32dc48e8e27056f1f53567b6378129de4dbe5ddda5cad04
7
+ data.tar.gz: 715465fba0ab874904ec97daeac15ed9fa77a9d03f2a5c34137cd4b63366995644c34a49884a66e492bc6508b9b9a76ed000de6b92b06bdf2fddf38a1b9fe1af
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hash-pipe (0.3.0)
4
+ hash-pipe (0.4.0)
5
5
  activesupport (~> 4.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (4.2.0)
10
+ activesupport (4.2.5.1)
11
11
  i18n (~> 0.7)
12
12
  json (~> 1.7, >= 1.7.7)
13
13
  minitest (~> 5.1)
@@ -16,9 +16,9 @@ GEM
16
16
  coderay (1.1.0)
17
17
  diff-lcs (1.2.5)
18
18
  i18n (0.7.0)
19
- json (1.8.2)
19
+ json (1.8.3)
20
20
  method_source (0.8.2)
21
- minitest (5.5.1)
21
+ minitest (5.8.4)
22
22
  pry (0.9.12.6)
23
23
  coderay (~> 1.0)
24
24
  method_source (~> 0.8)
@@ -43,3 +43,6 @@ DEPENDENCIES
43
43
  hash-pipe!
44
44
  pry (~> 0.9)
45
45
  rspec (~> 2.14)
46
+
47
+ BUNDLED WITH
48
+ 1.11.2
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "hash-pipe"
5
- s.version = "0.3.0"
5
+ s.version = "0.4.0"
6
6
  s.authors = ["Damien Timewell"]
7
7
  s.email = ["mail@damientimewell.com"]
8
8
  s.licenses = ['MIT']
@@ -24,4 +24,12 @@ Hash.class_eval do
24
24
  Hash.convert_keys self, method
25
25
  end
26
26
 
27
- end
27
+ end
28
+
29
+ Array.class_eval do
30
+
31
+ def convert_keys(method = :underscore)
32
+ Hash.convert_keys self, method
33
+ end
34
+
35
+ end
@@ -27,6 +27,14 @@ describe 'key_conversion' do
27
27
  Hash.convert_keys([{ 'HELLO' => 'world' }, { 'FOO' => 'bar' }]).should eq [{ 'hello' => 'world' }, { 'foo' => 'bar' }]
28
28
  end
29
29
 
30
+ it "should convert an array of hashes directly on the array" do
31
+ [{ 'HELLO' => 'world' }, { 'FOO' => 'bar' }].convert_keys.should eq [{ 'hello' => 'world' }, { 'foo' => 'bar' }]
32
+ end
33
+
34
+ it "should only convert hashes in the array" do
35
+ [{ 'HELLO' => 'world' }, 123].convert_keys.should eq [{ 'hello' => 'world' }, 123]
36
+ end
37
+
30
38
  it 'should convert arrays of hashes' do
31
39
  { 'HELLO' => [{ 'MR' => 'world' }] }.convert_keys.should eq 'hello' => [{'mr' => 'world'}]
32
40
  end
@@ -40,4 +48,4 @@ describe 'key_conversion' do
40
48
  { 'hello' => 'world' }.convert_keys(converter).should eq 'goodbye' => 'world'
41
49
  end
42
50
 
43
- end
51
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash-pipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Timewell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.2.2
99
+ rubygems_version: 2.5.1
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: A small collection of useful hash extensions
@@ -106,4 +106,3 @@ test_files:
106
106
  - spec/hash-pipe/nested_keys_spec.rb
107
107
  - spec/hash-pipe/value_checks_spec.rb
108
108
  - spec/spec_helper.rb
109
- has_rdoc: