Class: StageManager
- Inherits:
-
Object
- Object
- StageManager
- Defined in:
- lib/auto_tagger/stage_manager.rb
Defined Under Namespace
Classes: NoStagesSpecifiedError
Instance Attribute Summary collapse
-
#stages ⇒ Object
readonly
Returns the value of attribute stages.
Instance Method Summary collapse
-
#initialize(stages) ⇒ StageManager
constructor
A new instance of StageManager.
- #previous_stage(stage) ⇒ Object
Constructor Details
#initialize(stages) ⇒ StageManager
Returns a new instance of StageManager.
11 12 13 14 |
# File 'lib/auto_tagger/stage_manager.rb', line 11 def initialize(stages) raise NoStagesSpecifiedError unless stages && stages.is_a?(Array) @stages = stages end |
Instance Attribute Details
#stages ⇒ Object (readonly)
Returns the value of attribute stages.
9 10 11 |
# File 'lib/auto_tagger/stage_manager.rb', line 9 def stages @stages end |
Instance Method Details
#previous_stage(stage) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/auto_tagger/stage_manager.rb', line 16 def previous_stage(stage) if stage index = stages.index(stage) - 1 stages[index] if index > -1 end end |