Class: Bosh::Cli::TaskTracking::StageCollection
- Defined in:
- lib/cli/task_tracking/stage_collection.rb
Instance Attribute Summary collapse
-
#stages ⇒ Object
readonly
Returns the value of attribute stages.
Instance Method Summary collapse
-
#initialize(callbacks) ⇒ StageCollection
constructor
A new instance of StageCollection.
- #update_with_event(event) ⇒ Object
Constructor Details
#initialize(callbacks) ⇒ StageCollection
Returns a new instance of StageCollection.
5 6 7 8 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 5 def initialize(callbacks) @stages = [] @callbacks = callbacks end |
Instance Attribute Details
#stages ⇒ Object (readonly)
Returns the value of attribute stages.
3 4 5 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 3 def stages @stages end |
Instance Method Details
#update_with_event(event) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/cli/task_tracking/stage_collection.rb', line 10 def update_with_event(event) new_stage = Stage.new(event['stage'], event['tags'], event['total'], @callbacks) unless found_stage = @stages.find { |s| s == new_stage } found_stage = new_stage @stages << new_stage end found_stage.update_with_event(event) found_stage end |