Class: Fabulator::Core::Actions::Goto

Inherits:
Action
  • Object
show all
Defined in:
lib/fabulator/core/actions/choose.rb

Instance Method Summary collapse

Instance Method Details

#run(context, autovivify = false) ⇒ Object



66
67
68
69
70
71
# File 'lib/fabulator/core/actions/choose.rb', line 66

def run(context, autovivify = false)
  raise Fabulator::StateChangeException, @state, caller if @test.nil?
  test_res = @test.run(@context.merge(context)).collect{ |a| !!a.value }
  return [ ] if test_res.nil? || test_res.empty? || !test_res.include?(true)
  raise Fabulator::StateChangeException, @state, caller
end