Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Created November 26, 2013 02:03
Show Gist options
  • Save rubysolo/7652387 to your computer and use it in GitHub Desktop.
Save rubysolo/7652387 to your computer and use it in GitHub Desktop.
module Enumerable
def remove(other)
base = self.dup
other.each { |i| base.delete_at(base.index(i) || base.length) }
base
end
end
irb(main):008:0> [1,1,2,3].remove([1,2])
=> [1, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment