Class: FiniteMachine::EventDefinition Private

Inherits:
Object
  • Object
show all
Defined in:
lib/finite_machine/event_definition.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A class responsible for defining event methods on state machine

Used to add event definitions from TransitionBuilder to the StateMachine to obtain convenience helpers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine) ⇒ EventDefinition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize an EventDefinition

Parameters:



19
20
21
# File 'lib/finite_machine/event_definition.rb', line 19

def initialize(machine)
  @machine = machine
end

Instance Attribute Details

#machineObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The current state machine



12
13
14
# File 'lib/finite_machine/event_definition.rb', line 12

def machine
  @machine
end

Instance Method Details

#apply(event_name, silent = false) ⇒ nil

Define transition event names as state machine events

Parameters:

  • event_name (Symbol)

    the event name for which definition is created

Returns:

  • (nil)


31
32
33
34
# File 'lib/finite_machine/event_definition.rb', line 31

def apply(event_name, silent = false)
  define_event_transition(event_name, silent)
  define_event_bang(event_name, silent)
end