Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created October 2, 2015 15:09
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 anonymous/395ba703a4bf29ad660d to your computer and use it in GitHub Desktop.
Save anonymous/395ba703a4bf29ad660d to your computer and use it in GitHub Desktop.
# Pastebin bKmPxVww
data = [{'x'=>1}, {'x'=>2},{'x'=>'foo'}]
data.map{|h| OpenStruct.new(h)}.map(&:x)
# => [1, 2, "foo"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment