Class: Bosh::Cli::TaskTracking::TaskLogRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/task_tracking/task_log_renderer.rb

Direct Known Subclasses

EventLogRenderer, NullTaskLogRenderer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTaskLogRenderer

Returns a new instance of TaskLogRenderer


16
17
18
19
20
21
22
23
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 16

def initialize
  @out = Bosh::Cli::Config.output || $stdout
  @out.sync = true
  @output = ''

  @time_adjustment = 0
  @duration = nil
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration


14
15
16
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 14

def duration
  @duration
end

#time_adjustmentObject

Returns the value of attribute time_adjustment


13
14
15
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 13

def time_adjustment
  @time_adjustment
end

Class Method Details

.create_for_log_type(log_type) ⇒ Object


3
4
5
6
7
8
9
10
11
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 3

def self.create_for_log_type(log_type)
  if log_type == 'event'
    EventLogRenderer.new
  elsif log_type == 'result' || log_type == 'none'
    NullTaskLogRenderer.new
  else
    TaskLogRenderer.new
  end
end

Instance Method Details

#add_output(output) ⇒ Object


25
26
27
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 25

def add_output(output)
  @output = output
end

#duration_known?Boolean

Returns:

  • (Boolean)

38
39
40
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 38

def duration_known?
  false
end

#finish(state) ⇒ Object


34
35
36
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 34

def finish(state)
  refresh
end

#refreshObject


29
30
31
32
# File 'lib/cli/task_tracking/task_log_renderer.rb', line 29

def refresh
  @out.print(@output)
  @output = ''
end