Skip to content

Instantly share code, notes, and snippets.

@richievos
Created December 3, 2009 20:56
Show Gist options
  • Save richievos/248514 to your computer and use it in GitHub Desktop.
Save richievos/248514 to your computer and use it in GitHub Desktop.
class CreatedContext
def p
Proc.new { |x| puts "proc: #{self.inspect} on #{x.inspect}"}
end
def l
lambda { |x| puts "lambda: #{self.inspect} on #{x.inspect}"}
end
end
class Foo
def run(blocky_thing)
blocky_thing.call(self)
end
end
def magic
puts "lambda: #{self.inspect}"
end
Foo.new.run(CreatedContext.new.p)
Foo.new.run(CreatedContext.new.l)
Foo.new.run(:magic.to_proc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment