Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/expirer/core_ext/string/underscore_keys.rb

Instance Method Summary collapse

Instance Method Details

#underscore_keysObject



4
5
6
# File 'lib/expirer/core_ext/string/underscore_keys.rb', line 4

def underscore_keys
  dup.underscore_keys!
end

#underscore_keys!Object



8
9
10
11
12
13
14
# File 'lib/expirer/core_ext/string/underscore_keys.rb', line 8

def underscore_keys!
  keys.each do |key|
    self[key.underscore] = delete(key)
  end

  self
end