Sha256: 341237b7bee395d2b2b880fa051f1468854e409960e0e13f01c8532f4d6af1d7

Contents?: true

Size: 351 Bytes

Versions: 13

Compression:

Stored size: 351 Bytes

Contents

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

	def symbolize_keys!
		self.replace(symbolize_keys)
	end

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

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
taps-0.3.11 lib/taps/monkey.rb
dkastner-taps-0.3.11 lib/taps/monkey.rb
taps-0.3.10 lib/taps/monkey.rb
taps-0.3.9 lib/taps/monkey.rb
taps-0.3.8 lib/taps/monkey.rb
taps-0.3.7 lib/taps/monkey.rb
taps-0.3.6 lib/taps/monkey.rb
taps-0.3.5 lib/taps/monkey.rb
taps-0.3.4 lib/taps/monkey.rb
taps-0.3.3 lib/taps/monkey.rb
taps-0.3.2 lib/taps/monkey.rb
taps-0.3.1 lib/taps/monkey.rb
taps-0.3.0 lib/taps/monkey.rb