Class: Skiplock::Manager::Demux
- Inherits:
-
Object
- Object
- Skiplock::Manager::Demux
- Defined in:
- lib/skiplock/manager.rb
Instance Method Summary collapse
- #close ⇒ Object
- #flush ⇒ Object
-
#initialize(*targets, timestamp: true) ⇒ Demux
constructor
A new instance of Demux.
- #tty? ⇒ Boolean
- #write(*args) ⇒ Object
Constructor Details
#initialize(*targets, timestamp: true) ⇒ Demux
Returns a new instance of Demux.
96 97 98 99 |
# File 'lib/skiplock/manager.rb', line 96 def initialize(*targets, timestamp: true) @targets = targets @timestamp = end |
Instance Method Details
#close ⇒ Object
101 102 103 |
# File 'lib/skiplock/manager.rb', line 101 def close @targets.each(&:close) end |
#flush ⇒ Object
105 106 107 |
# File 'lib/skiplock/manager.rb', line 105 def flush @targets.each(&:flush) end |
#tty? ⇒ Boolean
109 110 111 |
# File 'lib/skiplock/manager.rb', line 109 def tty? true end |
#write(*args) ⇒ Object
113 114 115 116 |
# File 'lib/skiplock/manager.rb', line 113 def write(*args) args.prepend("[#{Time.now.utc}]: ") if @timestamp @targets.each {|t| t.write(*args)} end |