Class: Hash
Instance Method Summary collapse
-
#stringify_keys ⇒ Object
Return a copy of the hash with each key converted to a string.
-
#stringify_keys! ⇒ Object
_Hash is modified inline!_ Converts each key to a string.
Instance Method Details
#stringify_keys ⇒ Object
Return a copy of the hash with each key converted to a string.
5 6 7 8 9 10 11 |
# File 'lib/aastdlib/hash.rb', line 5 def stringify_keys() stringified = {} self.each {|k,v| stringified[k.to_s] = v} return stringified end |
#stringify_keys! ⇒ Object
_Hash is modified inline!_ Converts each key to a string.
14 15 16 17 18 19 20 |
# File 'lib/aastdlib/hash.rb', line 14 def stringify_keys!() stringified = self.stringify_keys() self.clear stringified.each {|k,v| self[k] = v} end |