Skip to content

Instantly share code, notes, and snippets.

@acook
Created February 29, 2012 19:57
Show Gist options
  • Save acook/1943982 to your computer and use it in GitHub Desktop.
Save acook/1943982 to your computer and use it in GitHub Desktop.
Array deletify - removes element matching block and returns it
class Array
def deletify! &block
self.each do |element|
return self.delete(element) if yield(element)
end
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment