Skip to content

Instantly share code, notes, and snippets.

@merbjedi
Created February 1, 2009 23:23
Show Gist options
  • Save merbjedi/56695 to your computer and use it in GitHub Desktop.
Save merbjedi/56695 to your computer and use it in GitHub Desktop.
class Symbol
def to_proc
Proc.new { |obj, *args| obj.send(self, *args) }
end
end
class Foo
def foo
:foo
end
end
@foos = [Foo.new] * 1_000_000
@foos.each(&:foo) #with shorthand
# @foos.each{|f| f.foo} #without shorthand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment