Skip to content

Instantly share code, notes, and snippets.

@luctraonmilin
Created November 25, 2013 11:03
Show Gist options
  • Save luctraonmilin/7639717 to your computer and use it in GitHub Desktop.
Save luctraonmilin/7639717 to your computer and use it in GitHub Desktop.
A Ruby programming interview question I had a few days ago: implement the method each for Array. Here is my answer.
class Array
def each(&block)
map &block
self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment