public Method

Hash.environmentize_keys!

Destructively and non-recursively convert each key to an uppercase string.

{ :name => "Bob", "age" => 12, "nick" => "Bobinator" }.environmentize_keys!
#=> { "NAME" => "Bob", "NICK" => "Bobinator", "AGE" => 12 }

Source Code

# File merb/core_ext/hash.rb, line 180
def environmentize_keys!
  keys.each do |key|
    self[key.to_s.upcase] = delete(key)
  end
  self
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.