class Chewie::Query::Bool

Attributes

attribute[R]
combine[R]
filters[R]
query_format[R]
value[R]
with[R]

Public Class Methods

new(handler, filters) click to toggle source
# File lib/chewie/query/bool.rb, line 8
def initialize(handler, filters)
  @attribute = handler[:attribute]
  @query_format = handler[:format]
  @with = handler[:with]
  @value = filters[attribute]
  @combine = handler[:combine]
  @filters = filters
end

Public Instance Methods

build() click to toggle source
# File lib/chewie/query/bool.rb, line 17
def build
  return {} if value.nil?
  return [] if [value].flatten.empty?

  context(with) do
    { attribute => exposed_value }
  end
end

Private Instance Methods

combined() click to toggle source
# File lib/chewie/query/bool.rb, line 46
def combined
  combine_values(combine, filters)
end
exposed_value() click to toggle source
# File lib/chewie/query/bool.rb, line 34
def exposed_value
  expose_or_return_value(formatted_value, with, should_format)
end
formatted_value() click to toggle source
# File lib/chewie/query/bool.rb, line 38
def formatted_value
  if should_format
    format_values(value, combined, query_format)
  else
    value
  end
end
should_format() click to toggle source
# File lib/chewie/query/bool.rb, line 30
def should_format
  query_format.present?
end