Skip to content

Instantly share code, notes, and snippets.

@arya
Created May 6, 2009 18:43
Show Gist options
  • Save arya/107664 to your computer and use it in GitHub Desktop.
Save arya/107664 to your computer and use it in GitHub Desktop.
#fails
class AnonymousFunction
def initialize(&func)
self.class.send(:define_method, :call, &func)
end
end
blah = 1
s = AnonymousFunction.new do |blah|
puts blah
blah = 3
end
s.call(2)
puts blah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment