Class: Deltacloud::StateMachine::State

Inherits:
Object
  • Object
show all
Defined in:
lib/deltacloud/state_machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine, name) ⇒ State

Returns a new instance of State.



38
39
40
41
42
# File 'lib/deltacloud/state_machine.rb', line 38

def initialize(machine, name)
  @machine = machine
  @name    = name
  @transitions = []
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



35
36
37
# File 'lib/deltacloud/state_machine.rb', line 35

def name
  @name
end

#transitionsObject (readonly)

Returns the value of attribute transitions.



36
37
38
# File 'lib/deltacloud/state_machine.rb', line 36

def transitions
  @transitions
end

Instance Method Details

#to(destination_name) ⇒ Object



48
49
50
51
52
53
# File 'lib/deltacloud/state_machine.rb', line 48

def to(destination_name)
  destination = @machine.state(destination_name)
  transition = Transition.new( @machine, destination )
  @transitions << transition
  transition
end

#to_sObject



44
45
46
# File 'lib/deltacloud/state_machine.rb', line 44

def to_s
  self.name.to_s
end