Module: Jsm::Client::InstanceMethods

Defined in:
lib/jsm/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/jsm/client.rb', line 8

def self.included(base)
  base.class_eval <<-EOFILE, __FILE__, __LINE__
    private :jsm_set_state
  EOFILE
end

Instance Method Details

#current_stateObject

able to get current state from here instead check from the targeted attribute



19
20
21
22
# File 'lib/jsm/client.rb', line 19

def current_state
  attr_state = state_machine.attribute_name
  instance_variable_get("@#{attr_state}".to_sym)
end

#jsm_set_state(val) ⇒ Object

used for set new state by JSM



25
26
27
28
# File 'lib/jsm/client.rb', line 25

def jsm_set_state(val)
  attr_state = state_machine.attribute_name
  instance_variable_set("@#{attr_state}".to_sym, val)
end

#state_machineObject



14
15
16
# File 'lib/jsm/client.rb', line 14

def state_machine
  self.class.respond_to?(:state_machine) ? self.class.state_machine : nil
end