Class: Rubble::Executor::Local::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/rubble/executor/local.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log) ⇒ Output

Returns a new instance of Output.



29
30
31
32
33
# File 'lib/rubble/executor/local.rb', line 29

def initialize(log)
    @log = log
    @lines = []
    @flushed = false
end

Instance Attribute Details

#linesObject (readonly)

Returns the value of attribute lines.



28
29
30
# File 'lib/rubble/executor/local.rb', line 28

def lines
  @lines
end

#logObject (readonly)

Returns the value of attribute log.



27
28
29
# File 'lib/rubble/executor/local.rb', line 27

def log
  @log
end

Instance Method Details

#<<(line) ⇒ Object



34
35
36
37
38
39
# File 'lib/rubble/executor/local.rb', line 34

def <<(line)
    @lines << line
    if @flushed then
        @log.add(line.level, line.text)
    end
end

#flushObject



40
41
42
43
44
45
# File 'lib/rubble/executor/local.rb', line 40

def flush
    @lines.each do |line|
        @log.add(line.level, line.text)
    end
    @flushed = true
end