handy_hash 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/handy_hash.rb +6 -2
- 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: 8bec069c3496c12cab6fb688e90c82feec214929
|
4
|
+
data.tar.gz: 3c13026b8e5a02e1e5b2c6ce72f400897108f5fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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]
|
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.
|
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-
|
11
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|