ds_hash 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjRmZGI5ZGRlZTUyMGI5MDhkNmU1M2IwMTMwZTBlODMwNGQzNTQ3Yw==
4
+ OTA1ZDM1YzNjMGU5NTE2MTM2Y2FiYTUzY2RlNTM4ZDhmZGQ1NjQ4MA==
5
5
  data.tar.gz: !binary |-
6
- ZGIyNjRiMGFhZDIxZTk0NmIxZGNjZjUwYWFhMmQ3NGVhYjMyMzI0Nw==
6
+ MTNiMTdiMzVmOTYzNzNiNjEzOTU2NTU0YzhhZGU2NjFjY2MxNTRiZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTM3MWMyYWEzZGU1NzI2Yjc0YWIwNjI3NzQyMGQwY2EwZThhZGZiMWVmYWVk
10
- ZTRhZjcyNTIyYjVlNzVhNDVkYTY5MjczMTBjMWFlZWNiYTE2ZmJiZDhiZmFk
11
- NGRhMTNkN2YzMTZmNzliMjk5ZTJmODNlMjQ3OTQ4ZTcxNmU1MGY=
9
+ MjdhNjdmNWUyY2QyMGIzMzQ3MGYyMGQ4ZTE0NmQ0ODAzYjdkZTE1ZmMwMmI2
10
+ MjljNjJkZmRhMWRiYzAyN2JiOTY4ZTgzZDAyMjFlZGYyMTJhNDliNTNlMzg5
11
+ NDg5ZmFhZWQ3MjYxYjUyMjA2MDMzZGRmNzcxYTUzODllYzRjYzA=
12
12
  data.tar.gz: !binary |-
13
- MDZkODUxNWM1MWY5ZTUyNGU3NGM5NTY2YTlkMGI1MjlkYjczNWJlZTBhYWY4
14
- YjhhYWY5NDMxYzNiYjdlZDc1NWVlMTY1ZjMxNzBiODI4NjE2OThiM2YzMTQy
15
- ZTgyZTgxYzE3NzcxZGViNjUyM2JhYzdkMTVmOGM3MTY2NzQxMzE=
13
+ Zjk5MjgxZTBkYjEwYmNmMTgzMDg4ZWQ3ODdkNWVkZTc3NmY5MjBkYjVkNjFm
14
+ MTI5NjliMGEzYjZiM2NiMzU0ODY5YjFiNzJkNzhhMDhlNjgyMmVkYjNiZTI2
15
+ MGRjMmU0YTNkMzk3YmE5MmYzNDgyYWYzNDQzNjc2ZGY3OTgyM2Y=
@@ -67,7 +67,7 @@ class Hash
67
67
  elsif self[key].is_a? Hash
68
68
  ret = self[key].deep_fetch(*keys)
69
69
  end
70
- ret || def_value
70
+ ret == nil ? def_value : ret
71
71
  end
72
72
  end
73
73
 
@@ -1,3 +1,3 @@
1
1
  module DsHash
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
data/spec/ds_hash_spec.rb CHANGED
@@ -3,7 +3,11 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "DsHash" do
4
4
 
5
5
  let(:hash_clean_values){
6
- { a: { b: 1, c: { d: 2 } }, g: 3 , j: [1,2]}
6
+ { a: { b: 1, c: { d: 2 } }, g: 3 , j: [1,2]}
7
+ }
8
+
9
+ let(:hash_with_false_values){
10
+ { a: { b: false}}
7
11
  }
8
12
 
9
13
  let(:hash_with_empty_values) {
@@ -48,6 +52,12 @@ context "#deep_fetch" do
48
52
  it { hash_clean_values.deep_fetch(:d, :a, :j, []).should eq [] }
49
53
  it { hash_clean_values.deep_fetch(:d, 'a').should eq 'a' }
50
54
  it { hash_clean_values.deep_fetch(:d, :a, :j, 'b').should eq 'b' }
55
+
56
+
57
+ it { hash_with_false_values.deep_fetch(:a, :b).should === false }
58
+ it { hash_with_false_values.deep_fetch(:a, :b, nil).should === false }
59
+
60
+
51
61
  end
52
62
 
53
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ds_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nardele salomon
@@ -109,5 +109,5 @@ rubyforge_project:
109
109
  rubygems_version: 2.2.1
110
110
  signing_key:
111
111
  specification_version: 4
112
- summary: Hash class extensions v. 1.1.0
112
+ summary: Hash class extensions v. 1.1.1
113
113
  test_files: []