Module: Finity::ClassMethods

Defined in:
lib/finity.rb

Overview

Class methods to be injected into the including class upon inclusion.

Instance Method Summary collapse

Instance Method Details

#eventsObject

Return the names of all registered events.



49
50
51
# File 'lib/finity.rb', line 49

def events
  @finity.events.map { |name, _| name }
end

#finity(options = {}, &block) ⇒ Object

Instantiate a new state machine for the including class by accepting a block with state and event (and subsequent transition) definitions.



39
40
41
# File 'lib/finity.rb', line 39

def finity options = {}, &block
  @finity ||= Machine.new self, options, &block
end

#statesObject

Return the names of all registered states.



44
45
46
# File 'lib/finity.rb', line 44

def states
  @finity.states.map { |name, _| name }
end