Module: Golem
- Defined in:
- lib/golem/model/transition.rb,
lib/golem.rb,
lib/golem/model/event.rb,
lib/golem/model/state.rb,
lib/golem/dsl/event_def.rb,
lib/golem/dsl/state_def.rb,
lib/golem/model/callback.rb,
lib/golem/model/condition.rb,
lib/golem/dsl/decision_def.rb,
lib/golem/dsl/transition_def.rb,
lib/golem/model/state_machine.rb,
lib/golem/dsl/state_machine_def.rb,
lib/golem/util/element_collection.rb
Overview
To change this template, choose Tools | Templates and open the template in the editor.
Defined Under Namespace
Modules: ClassMethods, DSL, Model, Util Classes: DefinitionSyntaxError, ImpossibleEvent, InvalidStateError
Class Method Summary collapse
Class Method Details
.included(mod) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/golem.rb', line 6 def self.included(mod) mod.extend Golem::ClassMethods # Override the initialize method in the object we're imbuing with statemachine # functionality so that we can do statemachine initialization when the object # is instantiated. mod.class_eval do alias_method :_initialize, :initialize def initialize(*args) # call the original initialize _initialize(*args) if respond_to?(:statemachines) self.statemachines.each{|name, sm| sm.init(self, *args)} end end end end |