| Path: | forwardable.rb |
| Last Update: | Sun Nov 04 00:41:57 GMT+10:00 2001 |
forwardable.rb -
$Release Version: 1.1$
$Revision: 1.2 $
$Date: 2001/11/03 13:41:57 $
by Keiju ISHITSUKA(keiju@ishitsuka.com)
original definition by delegator.rb
— Usage:
class Foo
extend Forwardable
def_delegators("@out", "printf", "print")
def_delegators(:@in, :gets)
def_delegator(:@contents, :[], "content_at")
end
f = Foo.new
f.printf ...
f.gets
f.content_at(1)
g = Goo.new
g.extend SingleForwardable
g.def_delegator("@out", :puts)
g.puts ...