def fire(obj, to_state = nil, *args)
      transitions = @transitions.select { |t| t.from == obj.current_state }
      fail InvalidTransition, error_message_for_invalid_transitions(obj) if transitions.size == 0

      next_state = nil
      transitions.each do |transition|
        next if to_state && !Array(transition.to).include?(to_state)
        next unless transition.executable?(obj, *args)

        next_state = to_state || Array(transition.to).first
        transition.execute(obj, *args)
        update_event_timestamp(obj, next_state) if timestamp_defined?
        break
      end
      # Update timestamps on obj if a timestamp has been defined
      next_state
    end
def fire(obj, to_state = nil, *args)
      transitions = @transitions.select { |t| t.from == obj.current_state }
      fail InvalidTransition, error_message_for_invalid_transitions(obj) if transitions.size == 0

      next_state = nil
      transitions.each do |transition|
        next if to_state && !Array(transition.to).include?(to_state)
        next unless transition.executable?(obj, *args)

        next_state = to_state || Array(transition.to).first
        transition.execute(obj, *args)
        update_event_timestamp(obj, next_state) if timestamp_defined?
        break
      end
      # Update timestamps on obj if a timestamp has been defined
      next_state
    end
:reek:TooManyStatements: { max_statements: 13 }