Sha256: ba5a6ed44a19f29679e49dd0e9ed3cc262de76811fec0ad62f05d87b42c51799

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module Finite

  # The transition class. Represents a transition between two states
  class Transition

    attr_reader :to, :from, :condition

    # Create a new transition object
    #
    # @param opts [Hash] the options for a transition. Include :to, :from, and :if
    def initialize(opts)
      @from = opts[:from]
      @to = opts[:to]
      @condition = opts[:if]
    end

    # Does this transition equal another transition?
    #
    # @param other [Transition] another transition
    # @return true if they are equal false if not
    def ==(other)
      from == other.from and to == other.to and condition == other.condition
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
finite-1.1.0 lib/finite/transition.rb