Skip to content

Instantly share code, notes, and snippets.

@rebx
Created April 18, 2013 22:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Some Ruby Idioms I have come across which are useful to me
# make a list into hash keys
list = %w{foo bar baz}
s ||= {}
list.each {|key| s[key.to_sym] = 1}
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment