Class: Nodectl::MultiIO
- Inherits:
-
Object
- Object
- Nodectl::MultiIO
- Defined in:
- lib/nodectl/multi_io.rb
Overview
Redirect ‘write` calls to multiple targets, used with standard ruby logger instance for writing messages to log file and stdout at the same time
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(*targets) ⇒ MultiIO
constructor
A new instance of MultiIO.
- #write(*args) ⇒ Object
Constructor Details
#initialize(*targets) ⇒ MultiIO
Returns a new instance of MultiIO.
5 6 7 |
# File 'lib/nodectl/multi_io.rb', line 5 def initialize(*targets) @targets = targets end |
Instance Method Details
#close ⇒ Object
13 14 15 |
# File 'lib/nodectl/multi_io.rb', line 13 def close @targets.each(&:close) end |
#write(*args) ⇒ Object
9 10 11 |
# File 'lib/nodectl/multi_io.rb', line 9 def write(*args) @targets.each {|t| t.write(*args)} end |