Class: BigMachine::State
- Inherits:
-
Object
- Object
- BigMachine::State
- Defined in:
- lib/big_machine/state.rb
Instance Attribute Summary collapse
-
#stateful ⇒ Object
readonly
Returns the value of attribute stateful.
Class Method Summary collapse
Instance Method Summary collapse
- #enter(*args, &block) ⇒ Object
- #exit(*args, &block) ⇒ Object
- #human_name ⇒ Object
-
#initialize(stateful) ⇒ State
constructor
A new instance of State.
- #transition_to(state_class, *args, &block) ⇒ Object
- #workflow_is(name) ⇒ Object
Constructor Details
#initialize(stateful) ⇒ State
6 7 8 |
# File 'lib/big_machine/state.rb', line 6 def initialize(stateful) @stateful = stateful end |
Instance Attribute Details
#stateful ⇒ Object (readonly)
Returns the value of attribute stateful.
4 5 6 |
# File 'lib/big_machine/state.rb', line 4 def stateful @stateful end |
Class Method Details
.available_methods ⇒ Object
14 15 16 |
# File 'lib/big_machine/state.rb', line 14 def self.available_methods public_instance_methods - State.public_instance_methods end |
.human_name ⇒ Object
18 19 20 |
# File 'lib/big_machine/state.rb', line 18 def self.human_name self.to_s.split('::').last.underscore end |
.transition_methods ⇒ Object
10 11 12 |
# File 'lib/big_machine/state.rb', line 10 def self.transition_methods public_instance_methods - State.public_instance_methods end |
Instance Method Details
#enter(*args, &block) ⇒ Object
34 35 36 |
# File 'lib/big_machine/state.rb', line 34 def enter(*args, &block) true end |
#exit(*args, &block) ⇒ Object
38 39 40 |
# File 'lib/big_machine/state.rb', line 38 def exit(*args, &block) true end |
#human_name ⇒ Object
22 23 24 |
# File 'lib/big_machine/state.rb', line 22 def human_name self.class.human_name end |
#transition_to(state_class, *args, &block) ⇒ Object
26 27 28 |
# File 'lib/big_machine/state.rb', line 26 def transition_to(state_class, *args, &block) @stateful.transition_to(state_class, *args, &block) end |
#workflow_is(name) ⇒ Object
30 31 32 |
# File 'lib/big_machine/state.rb', line 30 def workflow_is(name) @stateful.workflow == name end |