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.



55
56
57
58
59
# File 'lib/deltacloud/state_machine.rb', line 55

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



52
53
54
# File 'lib/deltacloud/state_machine.rb', line 52

def name
  @name
end

#transitionsObject (readonly)

Returns the value of attribute transitions.



53
54
55
# File 'lib/deltacloud/state_machine.rb', line 53

def transitions
  @transitions
end

Instance Method Details

#to(destination_name) ⇒ Object



65
66
67
68
69
70
# File 'lib/deltacloud/state_machine.rb', line 65

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

#to_sObject



61
62
63
# File 'lib/deltacloud/state_machine.rb', line 61

def to_s
  self.name.to_s
end