hashlib 0.0.31 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/hashlib.rb +15 -3
  2. metadata +1 -1
@@ -34,20 +34,32 @@ class Hash
34
34
  if root.has_key?(key)
35
35
  if root[key].is_a?(Hash)
36
36
  if rest.empty?
37
- return root[key]
37
+ if root[key].nil?
38
+ return default
39
+ else
40
+ return root[key]
41
+ end
38
42
  else
39
43
  return root[key].rget(rest, default)
40
44
  end
41
45
  elsif root[key].is_a?(Array) and root[key].first.is_a?(Hash)
42
46
  if rest.empty?
43
- return root[key]
47
+ if root[key].nil?
48
+ return default
49
+ else
50
+ return root[key]
51
+ end
44
52
  else
45
53
  return root[key].collect{|v|
46
54
  v.rget(rest, default)
47
55
  }.flatten
48
56
  end
49
57
  else
50
- return root[key]
58
+ if root[key].nil?
59
+ return default
60
+ else
61
+ return root[key]
62
+ end
51
63
  end
52
64
  else
53
65
  return default
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.31
4
+ version: 0.0.32
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: