handy_hash 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/handy_hash.rb +6 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70fa21ac126b4938727c2b6d6dae86c032bdafb2
4
- data.tar.gz: b259e9486a676adea3f87a6c90b3f8a6779eaa1c
3
+ metadata.gz: 8bec069c3496c12cab6fb688e90c82feec214929
4
+ data.tar.gz: 3c13026b8e5a02e1e5b2c6ce72f400897108f5fa
5
5
  SHA512:
6
- metadata.gz: 7b96dd38b1938111fa152821597498388dfff92949494cd6de794388a9cb581767e6a8b4ea226e2b86ad974922264b3388c73e904e8e68f3a5a6b0ac460a841a
7
- data.tar.gz: c59341767c876747f9702f095ba7577f18f3d2a243f2bc24e02d7eb06185441b1f24c0194457df7c4e2a360f6b747b2a0ba041853a18dcc97afd7a451ae83f2d
6
+ metadata.gz: 00cb9e60b46bb62e1dc11485a1ef65198648e44818fa27120e1cb05c4fefa8cb56c19afa2354ae0bbd0fb1a1b9ed9cb40a3c5efb9c9a4125eac7498926c9cfe5
7
+ data.tar.gz: c5b1cd1f286a43ff7c45ff02a6496a7554705c0edf67a5e5f3111ad0eff5b4e7e58f1e406a4bfca6d729ffe4ec9617871375596d0c3f873c800d32a116b8fb8e
data/lib/handy_hash.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'active_support/all'
2
2
 
3
3
  class HandyHash < HashWithIndifferentAccess
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
 
6
6
  class ValueMissingError < StandardError; end
7
7
 
@@ -49,7 +49,11 @@ class HandyHash < HashWithIndifferentAccess
49
49
  private
50
50
 
51
51
  def __fetch_value(key, required: false, default: nil)
52
- self[key] || default || (required ? raise(ValueMissingError, "value missing: \"#{key}\"") : HandyHash.Nil)
52
+ unless self[key].nil?
53
+ self[key]
54
+ else
55
+ default || (required ? raise(ValueMissingError, "value missing: \"#{key}\"") : HandyHash.Nil)
56
+ end
53
57
  end
54
58
 
55
59
  def __wrap(v)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handy_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - schebannyj
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport