Class: Yaso::Logic::Switch
Instance Attribute Summary
Attributes inherited from Base
#name, #on_failure, #on_success
Instance Method Summary collapse
Methods inherited from Base
#add_failure, #add_next_step, #initialize
Constructor Details
This class inherits a constructor from Yaso::Logic::Base
Instance Method Details
#call(context, instance) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/yaso/logic/switch.rb', line 6 def call(context, instance) instance.success = true switch_case = @invocable.call(context, instance) || raise(UnhandledSwitchCaseError, instance.class) if Invocable.call(switch_case).last.call(context, instance) @next_step else instance.success = false @failure end end |