Class: Finite::Transition

Inherits:
Object
  • Object
show all
Defined in:
lib/finite/transition.rb

Overview

The transition class. Represents a transition between two states

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Transition

Create a new transition object

Parameters:

  • opts (Hash)

    the options for a transition. Include :to and :from



11
12
13
14
# File 'lib/finite/transition.rb', line 11

def initialize(opts)
  @from = opts[:from]
  @to = opts[:to]
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



6
7
8
# File 'lib/finite/transition.rb', line 6

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



6
7
8
# File 'lib/finite/transition.rb', line 6

def to
  @to
end

Instance Method Details

#==(other) ⇒ Object

Does this transition equal another transition?

Parameters:

Returns:

  • true if they are equal false if not



20
21
22
# File 'lib/finite/transition.rb', line 20

def ==(other)
  from == other.from and to == other.to
end