Skip to content

Instantly share code, notes, and snippets.

@zachgersh
Created February 27, 2013 18:57
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 zachgersh/5050565 to your computer and use it in GitHub Desktop.
Save zachgersh/5050565 to your computer and use it in GitHub Desktop.
The weird wonders of shift
my_array_hash = [{"foo" => "bar"}, {"bagel" => "chips"}]
my_array_hash.shift["foo"]
returns bar
@zachgersh
Copy link
Author

Shift pushes the whole hash out of the array (since it is the first element)

Then we can find by key!

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