class Finite::State

The State class. Represents a state in the state machine.

Attributes

name[R]

Public Class Methods

new(name) click to toggle source

Create a new state

@param name [Symbol] the name of the state

# File lib/finite/state.rb, line 10
def initialize(name)
  @name = name
end

Public Instance Methods

==(state) click to toggle source

Overide the == method for state

@param state [Object] the state your comparing to @return true if they are equal false if not

# File lib/finite/state.rb, line 18
def ==(state)
  if state.is_a? Symbol
    @name == state
  elsif state.is_a? State
    @name == state.name
  else
    false
  end
end
inspect() click to toggle source

Overridden for p

# File lib/finite/state.rb, line 34
def inspect
  @name
end
to_s() click to toggle source

overrriden for puts and print

# File lib/finite/state.rb, line 29
def to_s
  @name.to_s
end