Module: Net::DNS::HashKeys

Included in:
Hash
Defined in:
lib/net/dns/core_ext.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#downcase_keys!Object

Returns an hash with all the keys turned into downcase

hsh = {"Test" => 1, "FooBar" => 2}
hsh.downcase_keys!
   #=> {"test"=>1,"foobar"=>2}


13
14
15
16
17
18
19
# File 'lib/net/dns/core_ext.rb', line 13

def downcase_keys!
  hsh = Hash.new
  self.each do |key,val|
    hsh[key.downcase] = val
  end
  self.replace(hsh)
end