module Jsm::Client::ClassMethods

Public Instance Methods

jsm_event_executor() click to toggle source

define type of event executor to be used

# File lib/jsm/client.rb, line 55
def jsm_event_executor
  Jsm::EventExecutor::Base
end
jsm_use(state_machine) click to toggle source
# File lib/jsm/client.rb, line 32
    def jsm_use(state_machine)
      self.class_eval <<-EODEF, __FILE__, __LINE__
        def self.state_machine
          #{state_machine}
        end
      EODEF
      Jsm::Machines.add_machines(self, state_machine.new(self))
    end
new(*args, &block) click to toggle source

override method new it is used for set the instance state attribute with initial_state if initial_state present & instance state attribute is nil

Calls superclass method
# File lib/jsm/client.rb, line 44
def new(*args, &block)
  obj = super
  initial_state = self.state_machine.initial_state

  if initial_state && !obj.current_state
    obj.send(:jsm_set_state, initial_state.name)
  end
  obj
end