Class: Hash

Inherits:
Object show all
Defined in:
lib/aastdlib/hash.rb

Instance Method Summary collapse

Instance Method Details

#stringify_keysObject

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