Class: Legion::Logging::MultiIO
- Inherits:
-
Object
- Object
- Legion::Logging::MultiIO
- Defined in:
- lib/legion/logging/multi_io.rb
Instance Method Summary collapse
- #close ⇒ Object
- #flush ⇒ Object
-
#initialize(*targets) ⇒ MultiIO
constructor
A new instance of MultiIO.
- #write(message) ⇒ Object
Constructor Details
#initialize(*targets) ⇒ MultiIO
Returns a new instance of MultiIO.
6 7 8 |
# File 'lib/legion/logging/multi_io.rb', line 6 def initialize(*targets) @targets = targets.flatten end |
Instance Method Details
#close ⇒ Object
16 17 18 |
# File 'lib/legion/logging/multi_io.rb', line 16 def close @targets.each { |t| t.close unless [$stdout, $stderr].include?(t) } end |
#flush ⇒ Object
20 21 22 |
# File 'lib/legion/logging/multi_io.rb', line 20 def flush @targets.each { |t| t.flush if t.respond_to?(:flush) } end |
#write(message) ⇒ Object
10 11 12 13 14 |
# File 'lib/legion/logging/multi_io.rb', line 10 def write() @targets.each do |t| t.write() end end |