Skip to content

Instantly share code, notes, and snippets.

@jqr
Forked from defunkt/Hash enumerable mismatch.rb
Created June 10, 2009 21:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jqr/127525 to your computer and use it in GitHub Desktop.
Save jqr/127525 to your computer and use it in GitHub Desktop.
# In ruby 1.9
{:one => 1, :two => 2}.select {|k,v| k == :one} #=> {:one=>1}
{:one => 1, :two => 2}.reject {|k,v| k == :one} #=> {:two=>2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment