Skip to content

Instantly share code, notes, and snippets.

@mattpuchlerz
Created August 6, 2010 20:46
Show Gist options
  • Select an option

  • Save mattpuchlerz/511977 to your computer and use it in GitHub Desktop.

Select an option

Save mattpuchlerz/511977 to your computer and use it in GitHub Desktop.
class Hash
def without *args
reject { |key, val| args.include? key }
end
end
h = { :one => 1, :two => 2, :three => 3 }
h.without :one
#=> { :two => 2, :three => 3 }
h.without :two, :three
#=> { :one => 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment