class Queryko::Filters::Base

Attributes

as[R]
column_name[R]
feature[R]
field[R]
query_object[R]
table_name[R]
table_name_override[R]

Public Class Methods

new(options = {}, feature) click to toggle source
# File lib/queryko/filters/base.rb, line 7
def initialize(options = {}, feature)
  @feature = feature
  @table_name_override = options[:table_name]
  @table_name = options[:table_name]
  @column_name = options.fetch(:column_name) { @feature.name }
  @as = options[:as]
end

Public Instance Methods

call(collection, token, query_object) click to toggle source
# File lib/queryko/filters/base.rb, line 15
def call(collection, token, query_object)
  @query_object = query_object
  @table_name = table_name_override || query_object.class.table_name

  perform(collection, token, query_object)
end
param_key_format() click to toggle source
# File lib/queryko/filters/base.rb, line 26
def param_key_format
  nil
end

Private Instance Methods

build_param_key() click to toggle source
# File lib/queryko/filters/base.rb, line 32
def build_param_key
  param_key_format || default_param_key_format
end
default_param_key_format() click to toggle source
# File lib/queryko/filters/base.rb, line 36
def default_param_key_format
  "#{column_name}_#{parameterized_name}"
end
parameterized_name() click to toggle source
# File lib/queryko/filters/base.rb, line 40
def parameterized_name
  self.class.name.split('::').last.underscore
end