lib/core/facets/hash/recursively.rb in facets-2.8.2 vs lib/core/facets/hash/recursively.rb in facets-2.8.3
- old
+ new
@@ -6,10 +6,11 @@
# h = {:a=>1, :b=>{:b1=>1, :b2=>2}}
# h.recursively{|h| h.rekey(&:to_s) }
# => {"a"=>1, "b"=>{"b1"=>1, "b2"=>2}}
#
def recursively(&block)
+ warn "Use #recusive instead of #recursively for future versions"
h = inject({}) do |hash, (key, value)|
if value.is_a?(Hash)
hash[key] = value.recursively(&block)
else
hash[key] = value
@@ -17,13 +18,12 @@
hash
end
yield h
end
- #
+ # In place form of #recursively.
def recursively!(&block)
replace(recursively(&block))
end
end
-