Class: Fate::Output::IOFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/fate/output.rb

Instance Method Summary collapse

Constructor Details

#initialize(master, name) ⇒ IOFilter

Returns a new instance of IOFilter.



24
25
26
27
28
# File 'lib/fate/output.rb', line 24

def initialize(master, name)
  @master = master
  @io = @master.io
  @name = name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/fate/output.rb', line 37

def method_missing(method, *args, &block)
  if @io.respond_to?(method)
    @io.send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#write(string) ⇒ Object

duck typing for IO



31
32
33
34
35
# File 'lib/fate/output.rb', line 31

def write(string)
  num = @io.write(@master.format(@name, string))
  @io.flush
  num
end