hashlib 0.0.19 → 0.0.20
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.
- data/lib/hashlib.rb +9 -1
- metadata +2 -2
data/lib/hashlib.rb
CHANGED
@@ -30,9 +30,17 @@ class Hash
|
|
30
30
|
# otherwise return default value
|
31
31
|
#
|
32
32
|
if rv.is_a?(Hash)
|
33
|
-
|
33
|
+
# attempt lookup by string
|
34
|
+
if rv.keys.include?(path[i])
|
34
35
|
rv = rv[path[i]]
|
35
36
|
next
|
37
|
+
|
38
|
+
# attempt lookup by symbol
|
39
|
+
elsif (path[i].to_sym rescue nil).is_a?(Symbol) and rv.keys.include?(path[i].to_sym)
|
40
|
+
rv = rv[path[i].to_sym]
|
41
|
+
next
|
42
|
+
|
43
|
+
# you fail it
|
36
44
|
else
|
37
45
|
return default
|
38
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
42
|
rubyforge_project:
|
43
|
-
rubygems_version: 1.8.
|
43
|
+
rubygems_version: 1.8.23
|
44
44
|
signing_key:
|
45
45
|
specification_version: 3
|
46
46
|
summary: Useful utility methods for working with Ruby hashes
|