Class: Toaster::StateTransition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pre_state = {}, parameters = {}, post_state = {}) ⇒ StateTransition

Returns a new instance of StateTransition.



15
16
17
18
19
# File 'lib/toaster/state/state_transition.rb', line 15

def initialize(pre_state={}, parameters={}, post_state={})
  @pre_state = pre_state
  @parameters = parameters
  @post_state = post_state
end

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



13
14
15
# File 'lib/toaster/state/state_transition.rb', line 13

def parameters
  @parameters
end

#post_stateObject

Returns the value of attribute post_state.



13
14
15
# File 'lib/toaster/state/state_transition.rb', line 13

def post_state
  @post_state
end

#pre_stateObject

Returns the value of attribute pre_state.



13
14
15
# File 'lib/toaster/state/state_transition.rb', line 13

def pre_state
  @pre_state
end

Instance Method Details

#==(obj) ⇒ Object



28
29
30
# File 'lib/toaster/state/state_transition.rb', line 28

def ==(obj)
  return eql?(obj)
end

#eql?(obj) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
# File 'lib/toaster/state/state_transition.rb', line 21

def eql?(obj)
  return false if !obj.kind_of?(StateTransition)
  return obj.pre_state.eql?(@pre_state) && 
          obj.parameters.eql?(@parameters) && 
          obj.post_state.eql?(@post_state)
end

#hashObject



32
33
34
# File 'lib/toaster/state/state_transition.rb', line 32

def hash()
  return @pre_state.hash + @parameters.hash + @post_state.hash
end