Skip to content

Instantly share code, notes, and snippets.

Created July 5, 2012 20:39
Show Gist options
  • Save anonymous/3056285 to your computer and use it in GitHub Desktop.
Save anonymous/3056285 to your computer and use it in GitHub Desktop.
unless [].respond_to? :delete_while
class Array
def delete_while(&block)
self.shift while !self.empty? and yield self[0]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment