Skip to content

Instantly share code, notes, and snippets.

@jmorton
Created April 6, 2010 18:40
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 jmorton/357931 to your computer and use it in GitHub Desktop.
Save jmorton/357931 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'active_support'
class Foo
def talk(arg)
puts "talking about '#{arg}'"
end
end
class Bar
attr_accessor :foo
delegate :talk, :to => :foo
end
bar = Bar.new
bar.foo = Foo.new
bar.talk('hi')
@jmorton
Copy link
Author

jmorton commented Apr 6, 2010

Demonstrating ability to pass arguments to methods that delegate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment