Skip to content

Instantly share code, notes, and snippets.

@rodrigomanhaes
Created May 15, 2010 03:51
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 rodrigomanhaes/401990 to your computer and use it in GitHub Desktop.
Save rodrigomanhaes/401990 to your computer and use it in GitHub Desktop.
class Foo
def initialize(&block)
@block = block
end
def call
@block.call
end
alias [] call
end
f = Foo.new { 5 }
puts f.call
puts f[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment