Class: Hash

Inherits:
Object show all
Defined in:
lib/wordnik_ruby_helpers.rb

Instance Method Summary collapse

Instance Method Details

#symbolize_and_underscore_keysObject



359
360
361
362
363
364
# File 'lib/wordnik_ruby_helpers.rb', line 359

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

#symbolize_and_underscore_keys!Object



366
367
368
# File 'lib/wordnik_ruby_helpers.rb', line 366

def symbolize_and_underscore_keys!
  self.replace(self.symbolize_and_underscore_keys)
end