Skip to content

Instantly share code, notes, and snippets.

@DGaffney
Created January 26, 2011 23:42
Show Gist options
  • Save DGaffney/797762 to your computer and use it in GitHub Desktop.
Save DGaffney/797762 to your computer and use it in GitHub Desktop.
ruby-1.8.7-p330 :005 > {}.class
=> Hash
ruby-1.8.7-p330 :006 > hash = {}
=> {}
ruby-1.8.7-p330 :007 > hash["blah"] = 1
=> 1
ruby-1.8.7-p330 :008 > hash
=> {"blah"=>1}
ruby-1.8.7-p330 :009 > hash[:blah]
=> nil
ruby-1.8.7-p330 :010 > Hash
=> Hash
ruby-1.8.7-p330 :011 > HashWithIndifferentAccess
=> HashWithIndifferentAccess
ruby-1.8.7-p330 :012 > HashWithIndifferentAccess.new(hash)
=> {"blah"=>1}
ruby-1.8.7-p330 :013 > gg = HashWithIndifferentAccess.new(hash)
=> {"blah"=>1}
ruby-1.8.7-p330 :014 > gg[:blah]
=> 1
ruby-1.8.7-p330 :015 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment