Module: Finity::ClassMethods
- Defined in:
- lib/finity.rb
Overview
Class methods to be injected into the including class upon inclusion.
Instance Method Summary collapse
-
#events ⇒ Object
Return the names of all registered events.
-
#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.
-
#states ⇒ Object
Return the names of all registered states.
Instance Method Details
#events ⇒ Object
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 = {}, &block @finity ||= Machine.new self, , &block end |
#states ⇒ Object
Return the names of all registered states.
44 45 46 |
# File 'lib/finity.rb', line 44 def states @finity.states.map { |name, _| name } end |