Skip to content

Instantly share code, notes, and snippets.

@felipeelias
Created September 27, 2011 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipeelias/1246160 to your computer and use it in GitHub Desktop.
Save felipeelias/1246160 to your computer and use it in GitHub Desktop.
Fixnum to_proc definition
class Fixnum
def to_proc
lambda { |x| x + self }
end
end
p [1, 2, 3].map(&2)
# => [3, 4, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment