Class: Dynflow::Director::SequenceCursor
- Inherits:
 - 
      Object
      
        
- Object
 - Dynflow::Director::SequenceCursor
 
 
- Defined in:
 - lib/dynflow/director/sequence_cursor.rb
 
Instance Method Summary collapse
- 
  
    
      #done?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
return true if we can’t move the cursor further, either when everyting is done in the sequence or there was some failure that prevents us from moving.
 - 
  
    
      #initialize(flow_manager, sequence, parent_cursor = nil)  ⇒ SequenceCursor 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of SequenceCursor.
 - 
  
    
      #what_is_next(work = nil, success = true)  ⇒ Array<Integer> 
    
    
  
  
  
  
  
  
  
  
  
    
New step_ids that can be done next.
 
Constructor Details
#initialize(flow_manager, sequence, parent_cursor = nil) ⇒ SequenceCursor
Returns a new instance of SequenceCursor.
      6 7 8 9 10 11 12 13  | 
    
      # File 'lib/dynflow/director/sequence_cursor.rb', line 6 def initialize(flow_manager, sequence, parent_cursor = nil) @flow_manager = flow_manager @sequence = sequence @parent_cursor = parent_cursor @todo = [] @index = -1 # starts before first element @no_error_so_far = true end  | 
  
Instance Method Details
#done? ⇒ Boolean
return true if we can’t move the cursor further, either when everyting is done in the sequence or there was some failure that prevents us from moving
      36 37 38  | 
    
      # File 'lib/dynflow/director/sequence_cursor.rb', line 36 def done? (!@no_error_so_far && done_here?) || @index == @sequence.size end  | 
  
#what_is_next(work = nil, success = true) ⇒ Array<Integer>
Returns new step_ids that can be done next.
      19 20 21 22 23 24 25 26 27 28 29 30 31  | 
    
      # File 'lib/dynflow/director/sequence_cursor.rb', line 19 def what_is_next(work = nil, success = true) unless work.nil? || @todo.delete(work) raise "marking as done work that was not expected: #{work.inspect}" end @no_error_so_far &&= success if done_here? return next_steps else return [] end end  |