Class: Bosh::Cli::TaskTracking::Task
- Extended by:
- Forwardable
- Defined in:
- lib/cli/task_tracking/stage_collection.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(stage, name, progress, callbacks) ⇒ Task
constructor
A new instance of Task.
- #update_with_event(event) ⇒ Object
Constructor Details
#initialize(stage, name, progress, callbacks) ⇒ Task
Returns a new instance of Task.
89 90 91 92 93 94 95 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 89 def initialize(stage, name, progress, callbacks) @stage = stage @name = name @progress = progress @callbacks = callbacks @total_duration = TotalDuration.new end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
84 85 86 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 84 def error @error end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
84 85 86 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 84 def name @name end |
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
84 85 86 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 84 def progress @progress end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
84 85 86 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 84 def stage @stage end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
84 85 86 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 84 def state @state end |
Instance Method Details
#update_with_event(event) ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 97 def update_with_event(event) @state = event['state'] @progress = event['progress'] @error = (event['data'] || {})['error'] @total_duration.started_at = event['time'] if @state == 'started' @total_duration.finished_at = event['time'] if @state == 'finished' || @state == 'failed' call_state_callback end |