Created
April 6, 2010 18:40
-
-
Save jmorton/357931 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demonstrating ability to pass arguments to methods that delegate.