Skip to content

Instantly share code, notes, and snippets.

@jmorton
Created April 6, 2010 18:40
Show Gist options
  • Select an option

  • Save jmorton/357931 to your computer and use it in GitHub Desktop.

Select an option

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

jmorton commented Apr 6, 2010

Copy link
Copy Markdown
Author

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