class FilterSet
  def initialize(filters, current: nil, default: nil)
    @filters = filters
    @current = current
    @default = default
  end

  def active?(filter)
    current_filter == filter
  end

  def current_filter
    @current || @default
  end

  def name_and_values(include_default: true)
    @filters.map { |filter| [filter.titleize, filter] }.tap do |result|
      result.prepend [@default.titleize, @default] if include_default
    end
  end
end
