Module: FiniteMachine::ClassMethods

Included in:
FiniteMachine
Defined in:
lib/finite_machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



51
52
53
# File 'lib/finite_machine.rb', line 51

def logger
  @logger
end

Instance Method Details

#define(&block) ⇒ Class

A factory method for creating reusable FiniteMachine definitions

Examples:

TrafficLights = FiniteMachine.define
lights_fm_a = TrafficLights.new
lights_fm_b = TrafficLights.new

Returns:

  • (Class)


77
78
79
# File 'lib/finite_machine.rb', line 77

def define(&block)
  Class.new(Definition, &block)
end

#new(*args, &block) ⇒ FiniteMachine::StateMachine

Initialize an instance of finite machine

Examples:

FiniteMachine.new do
  ...
end

Returns:



63
64
65
# File 'lib/finite_machine.rb', line 63

def new(*args, &block)
  StateMachine.new(*args, &block)
end