module Ni::Flows::Utils::HandleWait

Public Instance Methods

call_for_wait_continue(context, params={}) click to toggle source
# File lib/ni/flows/utils/handle_wait.rb, line 8
def call_for_wait_continue(context, params={})
  raise "Not implemented"
end
handle_current_wait?(context, name) click to toggle source
# File lib/ni/flows/utils/handle_wait.rb, line 3
def handle_current_wait?(context, name)
  interactor_klass.units_by_interface(:waited_for_name?).any? { |unit| unit.waited_for_name?(name) } ||
  check_all_subtree_for_wait(context, name, interactor_klass.units_by_interface(:handle_current_wait?))        
end

Private Instance Methods

check_all_subtree_for_wait(context, name, units) click to toggle source
# File lib/ni/flows/utils/handle_wait.rb, line 14
def check_all_subtree_for_wait(context, name, units)
  units.any? do |unit| 
    next_level_units = unit.interactor_klass.units_by_interface(:handle_current_wait?)
    
    unit.handle_current_wait?(context, name) || (next_level_units.any? && check_all_subtree_for_wait(context, name, next_level_units) )
  end 
end