Class: StateFlow::Guard

Inherits:
Element show all
Includes:
ActionClient, EventClient
Defined in:
lib/state_flow/guard.rb

Direct Known Subclasses

NamedGuard

Instance Attribute Summary

Attributes inherited from Element

#destination, #origin

Instance Method Summary collapse

Methods included from ActionClient

#action

Methods included from EventClient

#action_event, #event, #event_else, #event_for_action_result, #events, #handle_exception, #named_event, #recover

Methods included from ExceptionHandlerClient

#exception_handlers, #exception_handling

Methods inherited from Element

#flow, #initialize, #inspect, #retry_in_recovering, #state, #to, uninspected_var, uninspected_vars, #update_to_destination

Methods included from ElementVisitable

#visit

Constructor Details

This class inherits a constructor from StateFlow::Element

Instance Method Details

#match?(context) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/state_flow/guard.rb', line 8

def match?(context)
  true
end

#process(context) ⇒ Object



12
13
14
15
16
17
# File 'lib/state_flow/guard.rb', line 12

def process(context)
  exception_handling(context) do
    action.process(context) if action
    update_to_destination(context)
  end
end