Class: Hash

Inherits:
Object show all
Defined in:
lib/right_resource/core_ext/hash/alter_keys.rb

Instance Method Summary collapse

Instance Method Details

#alter_keysObject



2
3
4
5
6
7
# File 'lib/right_resource/core_ext/hash/alter_keys.rb', line 2

def alter_keys
  attrs = {}
  self.each_pair {|key,value| attrs[key.to_s.gsub('-', '_').to_sym] = value}
  self.clear.merge!(attrs).rehash if attrs
  self
end