Class: FSM::Event

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/fsm-0.0.0/event.rb

Direct Known Subclasses

Any

Defined Under Namespace

Classes: Any, Entry, Exit, Input, Transition

Constant Summary collapse

NOTIFICATION =
"fsm_event"
TYPES =
Any, Exit, Transition, Entry, Input

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

included

Constructor Details

#initialize(state, *data, &b) ⇒ Event

Returns a new instance of Event.


26
27
28
29
30
# File 'lib/fsm-0.0.0/event.rb', line 26

def initialize state, *data, &b
  super
  @state, @data = state, *data
  @type = self.class
end

Class Method Details

.messageObject


58
59
60
# File 'lib/fsm-0.0.0/event.rb', line 58

def self.message
  name.split(%r/::/).last.downcase
end

Instance Method Details

#inspectObject


36
37
38
# File 'lib/fsm-0.0.0/event.rb', line 36

def inspect
  [@type, @state, @data].inspect
end

#notify(s, *a, &b) ⇒ Object


32
33
34
# File 'lib/fsm-0.0.0/event.rb', line 32

def notify s, *a, &b
  mcall(s, NOTIFICATION, self, *a, &b) if s.respond_to? NOTIFICATION
end