Module: AASM
- Defined in:
- lib/aasm/aasm.rb,
lib/aasm/base.rb,
lib/aasm/errors.rb,
lib/aasm/version.rb,
lib/aasm/localizer.rb,
lib/aasm/persistence.rb,
lib/aasm/configuration.rb,
lib/aasm/instance_base.rb,
lib/aasm/state_machine.rb,
lib/aasm/persistence/base.rb,
lib/aasm/state_machine_store.rb,
lib/generators/aasm/orm_helpers.rb,
lib/generators/aasm/aasm_generator.rb,
lib/aasm/persistence/plain_persistence.rb,
lib/aasm/persistence/redis_persistence.rb,
lib/aasm/persistence/sequel_persistence.rb,
lib/aasm/persistence/mongoid_persistence.rb,
lib/aasm/persistence/dynamoid_persistence.rb,
lib/aasm/persistence/mongo_mapper_persistence.rb,
lib/aasm/persistence/active_record_persistence.rb,
lib/aasm/persistence/core_data_query_persistence.rb
Defined Under Namespace
Modules: ClassMethods, Core, Generators, Persistence Classes: Base, Configuration, InstanceBase, InvalidTransition, Localizer, NoDirectAssignmentError, StateMachine, StateMachineStore, UndefinedState, UnknownStateMachineError
Constant Summary collapse
- VERSION =
"4.11.0"
Class Method Summary collapse
-
.included(base) ⇒ Object
provide a state machine for the including class make sure to load class methods as well initialize persistence for the state machine.
Instance Method Summary collapse
-
#aasm(name = :default) ⇒ Object
this is the entry point for all instance-level access to AASM.
- #initialize_dup(other) ⇒ Object
Class Method Details
.included(base) ⇒ Object
provide a state machine for the including class make sure to load class methods as well initialize persistence for the state machine
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/aasm/aasm.rb', line 6 def self.included(base) #:nodoc: base.extend AASM::ClassMethods # do not overwrite existing state machines, which could have been created by # inheritance, see class method inherited AASM::StateMachineStore.register(base) AASM::Persistence.load_persistence(base) super end |
Instance Method Details
#aasm(name = :default) ⇒ Object
this is the entry point for all instance-level access to AASM
66 67 68 69 70 71 72 |
# File 'lib/aasm/aasm.rb', line 66 def aasm(name=:default) unless AASM::StateMachineStore.fetch(self.class, true).machine(name) raise AASM::UnknownStateMachineError.new("There is no state machine with the name '#{name}' defined in #{self.class.name}!") end @aasm ||= {} @aasm[name.to_sym] ||= AASM::InstanceBase.new(self, name.to_sym) end |
#initialize_dup(other) ⇒ Object
74 75 76 77 |
# File 'lib/aasm/aasm.rb', line 74 def initialize_dup(other) @aasm = {} super end |