hashlib 0.0.12 → 0.0.13
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 +6 -2
- metadata +1 -1
data/lib/hashlib.rb
CHANGED
@@ -98,7 +98,7 @@ class Hash
|
|
98
98
|
rv
|
99
99
|
end
|
100
100
|
|
101
|
-
def each_recurse(root=self, path=[], &block)
|
101
|
+
def each_recurse(root=self, path=[], inplace=false, &block)
|
102
102
|
root.each do |k,v|
|
103
103
|
path << k
|
104
104
|
|
@@ -106,13 +106,17 @@ class Hash
|
|
106
106
|
each_recurse(v, path, &block)
|
107
107
|
else
|
108
108
|
rv = yield(k, v, path)
|
109
|
-
root[k] = rv
|
109
|
+
root[k] = rv if inplace === true
|
110
110
|
end
|
111
111
|
|
112
112
|
path.pop
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
def each_recurse!(root=self, path=[], &block)
|
117
|
+
each_recurse(root, path, true, &block)
|
118
|
+
end
|
119
|
+
|
116
120
|
def compact
|
117
121
|
def _is_empty?(i)
|
118
122
|
i === nil or (i.is_a?(String) and i.strip.chomp.empty?) or (i.respond_to?(:empty?) and i.empty?)
|