ruud grosmann
9/30/2008 9:24:00 AM
Hi list,
I am reading the book 'design patterns in ruby'. On page 201 I find
this code example:
require 'forwardable'
class WriterDecorator
extend Forwardable
def_delegators :@real_writer, :write_line, :rewind, :pos, :close
def initialize (real_writer)
@real_writer = real_writer
end
end
I am a bit surprised by the 'extend Forwardable' line. Can anybody
explain me what this is? Is it the same as 'include Forwardable' or is
it the same as 'class WriterDecorator < Forwardable'?
thanks in advance, Ruud