class Mutator::Transition

Attributes

from[R]
machine[R]
to[R]

Public Class Methods

new(opts) click to toggle source
# File lib/mutator/transition.rb, line 5
def initialize opts
  @to = opts.fetch(:to)
  @from = opts.fetch(:from)
  @machine = opts.fetch(:machine)
end

Public Instance Methods

==(other) click to toggle source
# File lib/mutator/transition.rb, line 23
def == other
  to == other.to && from == other.from && machine == other.machine
end
call() click to toggle source
# File lib/mutator/transition.rb, line 11
def call
  stateholder.state = to if valid?
end
eql?(other) click to toggle source
# File lib/mutator/transition.rb, line 27
def eql? other
  public_send :==, other
end
stateholder() click to toggle source
# File lib/mutator/transition.rb, line 19
def stateholder
  machine.stateholder
end
valid?() click to toggle source
# File lib/mutator/transition.rb, line 15
def valid?
  transitions.length > 0
end

Protected Instance Methods

transitions() click to toggle source
# File lib/mutator/transition.rb, line 33
def transitions
  machine.transitions.select do |transition|
    transition[:to] == to && Array(transition[:from]).include?(from)
  end
end