aasm/lib/state_machine.rb

22 lines
472 B
Ruby
Raw Normal View History

module AASM
unless AASM.const_defined?('StateMachineFactory')
StateMachineFactory = {}
end
class StateMachine
attr_accessor :states, :events, :initial_state
attr_reader :name
def initialize(name)
@name = name
@initial_state = nil
@states = []
@events = {}
end
2008-05-31 22:33:17 +00:00
def create_state(name, options)
@states << AASM::SupportingClasses::State.new(name, options) unless @states.include?(name)
end
end
end