R
ruud grosmann
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,
os, :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
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
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