def transition(start_states, end_states)
canonical_end_states = canonical_hash_form(end_states)
Array(start_states).each do |start_state|
unless self.valid_states.include?(start_state)
abort "Invalid state :#{start_state}. Must be one of the symbols #{self.valid_states.map{|x| ":#{x}"}.join(', ')}"
end
m = Metric.new(self, canonical_end_states)
if block_given?
yield(m)
else
m.condition(:always) do |c|
c.what = true
end
end
m.conditions.each do |c|
self.directory[c] = m
end
self.metrics[start_state] ||= []
self.metrics[start_state] << m
end
end