Module: HybridStateModel::Core
- Defined in:
- lib/hybrid_state_model/core.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #can_transition_to_micro?(new_micro_state) ⇒ Boolean
- #can_transition_to_primary?(new_state) ⇒ Boolean
- #micro_state ⇒ Object
- #micro_state_value ⇒ Object
- #primary_state ⇒ Object
- #primary_state_value ⇒ Object
- #state_machine ⇒ Object
- #valid_micro_state?(state) ⇒ Boolean
- #valid_primary_state?(state) ⇒ Boolean
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/hybrid_state_model/core.rb', line 5 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#can_transition_to_micro?(new_micro_state) ⇒ Boolean
47 48 49 |
# File 'lib/hybrid_state_model/core.rb', line 47 def can_transition_to_micro?(new_micro_state) state_machine.can_transition_to_micro?(self, new_micro_state) end |
#can_transition_to_primary?(new_state) ⇒ Boolean
43 44 45 |
# File 'lib/hybrid_state_model/core.rb', line 43 def can_transition_to_primary?(new_state) state_machine.can_transition_to_primary?(self, new_state) end |
#micro_state ⇒ Object
19 20 21 |
# File 'lib/hybrid_state_model/core.rb', line 19 def micro_state state_machine.micro_field end |
#micro_state_value ⇒ Object
31 32 33 |
# File 'lib/hybrid_state_model/core.rb', line 31 def micro_state_value send(micro_state) end |
#primary_state ⇒ Object
15 16 17 |
# File 'lib/hybrid_state_model/core.rb', line 15 def primary_state state_machine.primary_field end |
#primary_state_value ⇒ Object
27 28 29 |
# File 'lib/hybrid_state_model/core.rb', line 27 def primary_state_value send(primary_state) end |
#state_machine ⇒ Object
23 24 25 |
# File 'lib/hybrid_state_model/core.rb', line 23 def state_machine self.class.state_machine end |
#valid_micro_state?(state) ⇒ Boolean
39 40 41 |
# File 'lib/hybrid_state_model/core.rb', line 39 def valid_micro_state?(state) state_machine.valid_micro_state?(state, primary_state_value) end |
#valid_primary_state?(state) ⇒ Boolean
35 36 37 |
# File 'lib/hybrid_state_model/core.rb', line 35 def valid_primary_state?(state) state_machine.valid_primary_state?(state) end |