Sha256: 8997255a020653f5711efe8870f982034e3d7d5d85df34420359c3ab2aba9503
Contents?: true
Size: 599 Bytes
Versions: 15
Compression:
Stored size: 599 Bytes
Contents
require 'ostruct' module AASM class StateMachine def self.[](*args) (@machines ||= {})[args] end def self.[]=(*args) val = args.pop (@machines ||= {})[args] = val end attr_accessor :states, :events, :initial_state, :config attr_reader :name def initialize(name) @name = name @initial_state = nil @states = [] @events = {} @config = OpenStruct.new end def create_state(name, options) @states << AASM::SupportingClasses::State.new(name, options) unless @states.include?(name) end end end
Version data entries
15 entries across 15 versions & 7 rubygems