Class: Fate::Output::IOFilter
- Inherits:
-
Object
- Object
- Fate::Output::IOFilter
- Defined in:
- lib/fate/output.rb
Instance Method Summary collapse
-
#initialize(master, name) ⇒ IOFilter
constructor
A new instance of IOFilter.
- #method_missing(method, *args, &block) ⇒ Object
-
#write(string) ⇒ Object
duck typing for IO.
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 |