Class: BigMachine::State

Inherits:
Object
  • Object
show all
Defined in:
lib/big_machine/state.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#statefulObject (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_methodsObject



14
15
16
# File 'lib/big_machine/state.rb', line 14

def self.available_methods
  public_instance_methods - State.public_instance_methods
end

.human_nameObject



18
19
20
# File 'lib/big_machine/state.rb', line 18

def self.human_name
  self.to_s.split('::').last.underscore
end

.transition_methodsObject



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_nameObject



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