Class: StateFlow::ActionEvent

Inherits:
Event show all
Defined in:
lib/state_flow/action_event.rb

Constant Summary collapse

ELSE =
Object.new

Instance Attribute Summary collapse

Attributes inherited from Element

#destination, #origin

Instance Method Summary collapse

Methods inherited from Event

#process

Methods included from ExceptionHandlerClient

#exception_handlers, #exception_handling

Methods included from ActionClient

#action

Methods included from GuardClient

#guard, #guard_else, #guard_for, #guards

Methods inherited from Element

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

Methods included from ElementVisitable

#visit

Constructor Details

#initialize(origin, matcher, &block) ⇒ ActionEvent

Returns a new instance of ActionEvent.



9
10
11
12
# File 'lib/state_flow/action_event.rb', line 9

def initialize(origin, matcher, &block)
  @matcher = matcher
  super(origin, &block)
end

Instance Attribute Details

#matcherObject (readonly)

Returns the value of attribute matcher.



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

def matcher
  @matcher
end

Instance Method Details

#match?(action_result) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/state_flow/action_event.rb', line 14

def match?(action_result)
  return true if matcher == ActionEvent::ELSE
  matcher === action_result
end