Class: Fate::Output::IOMux
- Inherits:
-
Object
- Object
- Fate::Output::IOMux
- Defined in:
- lib/fate/output.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#last_identifier ⇒ Object
Returns the value of attribute last_identifier.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #format(name, string) ⇒ Object
-
#initialize(options) ⇒ IOMux
constructor
A new instance of IOMux.
Constructor Details
#initialize(options) ⇒ IOMux
Returns a new instance of IOMux.
49 50 51 52 53 54 55 56 57 |
# File 'lib/fate/output.rb', line 49 def initialize() @last_identifier = nil if file = [:file] @io = File.new(file, "a") elsif io = [:io] @io = io end @handlers = {} end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
47 48 49 |
# File 'lib/fate/output.rb', line 47 def io @io end |
#last_identifier ⇒ Object
Returns the value of attribute last_identifier.
48 49 50 |
# File 'lib/fate/output.rb', line 48 def last_identifier @last_identifier end |
Instance Method Details
#[](name) ⇒ Object
59 60 61 |
# File 'lib/fate/output.rb', line 59 def [](name) @handlers[name] ||= IOFilter.new(self, name) end |
#format(name, string) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/fate/output.rb', line 63 def format(name, string) if name == @last_identifier string else @last_identifier = name "==> #{name} <==\n#{string}" end end |