Skip to content

Instantly share code, notes, and snippets.

@npatmaja
Created August 20, 2014 17:47
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 npatmaja/2cc78619a96a84631d8b to your computer and use it in GitHub Desktop.
Save npatmaja/2cc78619a96a84631d8b to your computer and use it in GitHub Desktop.
Ruby Hash

Several ways to define a hash in ruby:

hash = { 
  :key1 => "value1",
  :key2 => "value2"
}

or with syntactic sugar:

hash = { 
  key1: "value1",
  key2: "value2"
}

I prefer the latter as it is cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment