1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/lib/state_machine.rb
2008-05-31 15:33:17 -07:00

21 lines
472 B
Ruby

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
def create_state(name, options)
@states << AASM::SupportingClasses::State.new(name, options) unless @states.include?(name)
end
end
end