Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/taps/monkey.rb

Instance Method Summary collapse

Instance Method Details

#symbolize_keysObject



2
3
4
5
6
7
# File 'lib/taps/monkey.rb', line 2

def symbolize_keys
	inject({}) do |options, (key, value)|
		options[(key.to_sym rescue key) || key] = value
		options
	end
end

#symbolize_keys!Object



9
10
11
# File 'lib/taps/monkey.rb', line 9

def symbolize_keys!
	self.replace(symbolize_keys)
end

#symbolize_recursively!Object



13
14
15
16
17
18
19
20
# File 'lib/taps/monkey.rb', line 13

def symbolize_recursively!
	self.replace(symbolize_keys)
	self.each do |k, v|
		if v.kind_of?(Hash)
			v.symbolize_keys!
		end
	end
end