Skip to content

Instantly share code, notes, and snippets.

@stujo
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stujo/8744415 to your computer and use it in GitHub Desktop.
Save stujo/8744415 to your computer and use it in GitHub Desktop.
#Declaring a new Hash instance
creditcard = {
"name" => "Billy Bob",
"number" => "4444333322221111",
"code" => "555",
"expiry" => "07/2016"
}
#How about adding new key value pairs?
creditcard['exp_year']=2016
creditcard['exp_month']=7
#How about deleting values?
creditcard.delete "expiry"
#What about JSON?
creditcard.to_json
require 'json'
creditcard.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment