Class: Skiplock::Manager::Demux

Inherits:
Object
  • Object
show all
Defined in:
lib/skiplock/manager.rb

Instance Method Summary collapse

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 = timestamp
end

Instance Method Details

#closeObject



101
102
103
# File 'lib/skiplock/manager.rb', line 101

def close
  @targets.each(&:close)
end

#flushObject



105
106
107
# File 'lib/skiplock/manager.rb', line 105

def flush
  @targets.each(&:flush)
end

#tty?Boolean

Returns:

  • (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