Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/humanized_full_messages/hash.rb

Instance Method Summary collapse

Instance Method Details

#rekey(h) ⇒ Object



2
3
4
# File 'lib/humanized_full_messages/hash.rb', line 2

def rekey(h)
  dup.rekey! h
end

#rekey!(h) ⇒ Object



6
7
8
9
# File 'lib/humanized_full_messages/hash.rb', line 6

def rekey!(h)
  h.each { |k, newk| store(newk, delete(k)) if has_key? k }
  self
end