Class: Dapp::Project::Shellout::Streaming::Proxy::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dapp/project/shellout/streaming.rb

Overview

Base

Direct Known Subclasses

Error

Instance Method Summary collapse

Constructor Details

#initialize(*streams, with_time: false) ⇒ Base

Returns a new instance of Base.



25
26
27
28
# File 'lib/dapp/project/shellout/streaming.rb', line 25

def initialize(*streams, with_time: false)
  @streams = streams
  @with_time = with_time
end

Instance Method Details

#<<(str) ⇒ Object



30
31
32
# File 'lib/dapp/project/shellout/streaming.rb', line 30

def <<(str)
  @streams.each { |s| s << format_string(str) }
end

#format_string(str) ⇒ Object



34
35
36
# File 'lib/dapp/project/shellout/streaming.rb', line 34

def format_string(str)
  str.lines.map { |l| "#{Project.log_time if @with_time}#{l.strip}\n" }.join
end