Module: SimplerStateMachine::InstanceMethods
- Defined in:
- lib/simpler_state_machine/simple_state_machine.rb
Instance Method Summary collapse
-
#current_state ⇒ Object
Return the current state.
-
#enum_status ⇒ Object
Return the enum status.
-
#human_status_name ⇒ Object
human name for status.
-
#initialize(*args) ⇒ Object
Set the initial status value.
Instance Method Details
#current_state ⇒ Object
Return the current state
60 61 62 |
# File 'lib/simpler_state_machine/simple_state_machine.rb', line 60 def current_state self.send(self.class.state_machine.state_field) end |
#enum_status ⇒ Object
Return the enum status
55 56 57 |
# File 'lib/simpler_state_machine/simple_state_machine.rb', line 55 def enum_status self.class.state_machine.states[self.current_state] end |
#human_status_name ⇒ Object
human name for status
65 66 67 |
# File 'lib/simpler_state_machine/simple_state_machine.rb', line 65 def human_status_name enum_status end |
#initialize(*args) ⇒ Object
Set the initial status value
45 46 47 48 49 50 51 52 |
# File 'lib/simpler_state_machine/simple_state_machine.rb', line 45 def initialize(*args) begin super rescue ArgumentError # Catch in case the super does not get parameters super() end self.send("#{self.class.state_machine.state_field}=", self.class.state_machine.states[self.class.state_machine.initial_state].to_i) end |