Skip to content

Instantly share code, notes, and snippets.

@knewter
Created September 1, 2012 06:02
Show Gist options
  • Save knewter/3565125 to your computer and use it in GitHub Desktop.
Save knewter/3565125 to your computer and use it in GitHub Desktop.
quickie explanation of #method
class Foo
def initialize baz
@baz = baz
end
def bar
puts @baz
end
end
class Wiggy
def initialize(disconnected_method)
@disconnected_method = disconnected_method
end
def run
@disconnected_method.call
end
end
f = Foo.new("tad")
w = Wiggy.new(f.method(:bar))
w.run
#=> "tad"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment