lib/finite/transition.rb in finite-1.0.0 vs lib/finite/transition.rb in finite-1.1.0
- old
+ new
@@ -1,24 +1,25 @@
module Finite
# The transition class. Represents a transition between two states
class Transition
- attr_reader :to, :from
+ attr_reader :to, :from, :condition
# Create a new transition object
#
- # @param opts [Hash] the options for a transition. Include :to and :from
+ # @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
+ from == other.from and to == other.to and condition == other.condition
end
end
end
\ No newline at end of file