documented hash
This commit is contained in:
parent
307a57d176
commit
495d86392d
|
@ -1,10 +1,12 @@
|
||||||
class Hash
|
class Hash
|
||||||
|
# Stringify the keys in the hash. Returns a new hash.
|
||||||
def stringify_keys
|
def stringify_keys
|
||||||
inject({}) do |options, (key, value)|
|
inject({}) do |options, (key, value)|
|
||||||
options[key.to_s] = value
|
options[key.to_s] = value
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# Stringify the keys in the hash in place.
|
||||||
def stringify_keys!
|
def stringify_keys!
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
self[key.to_s] = delete(key)
|
self[key.to_s] = delete(key)
|
||||||
|
|
Loading…
Reference in New Issue