<commit_before># frozen_string_literal: true

#
# Routes constraints for Ad routes
#
class AdConstraint
  include StringUtils

  def matches?(request)
    params = request.path_parameters

    return false unless valid_page?(params[:page])

    return false unless valid_combination?(params[:type], params[:status])

    true
  end

  private

  def valid_combination?(type, status)
    [
      [nil, nil],
      ['want', nil],
      ['give', nil],
      %w[give available],
      %w[give booked],
      %w[give delivered]
    ].include?([type, status])
  end

  def valid_page?(page)
    page.nil? || positive_integer?(page)
  end
end<commit_msg>Clearer style for param matrix<commit_after># frozen_string_literal: true

#
# Routes constraints for Ad routes
#
class AdConstraint
  include StringUtils

  def matches?(request)
    params = request.path_parameters

    return false unless valid_page?(params[:page])

    return false unless valid_combination?(params[:type], params[:status])

    true
  end

  private

  def valid_combination?(type, status)
    # rubocop:disable Style/WordArray
    [
      [nil, nil],
      ['want', nil],
      ['give', nil],
      ['give', 'available'],
      ['give', 'booked'],
      ['give', 'delivered']
    ].include?([type, status])
    # rubocop:enable Style/WordArray
  end

  def valid_page?(page)
    page.nil? || positive_integer?(page)
  end
end
{'fraction_non_alphanumeric': 0.12616487455197134, 'fraction_numerical': 0.0, 'mean_word_length': 3.4037854889589907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1178625', 'n_tokens_mistral': 444, 'n_tokens_neox': 431, 'n_words': 111}