Class: Queryko::Filters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/queryko/filters/base.rb

Direct Known Subclasses

After, Batch, Before, Max, Min, Order, Paginate, Search

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, feature) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
# File 'lib/queryko/filters/base.rb', line 6

def initialize(options = {}, feature)
  @feature = feature
  @table_name = options[:table_name]
  @column_name = options.fetch(:column_name) { @feature.name }
  @as = options[:as]
end

Instance Attribute Details

#asObject (readonly)

Returns the value of attribute as.



4
5
6
# File 'lib/queryko/filters/base.rb', line 4

def as
  @as
end

#column_nameObject (readonly)

Returns the value of attribute column_name.



4
5
6
# File 'lib/queryko/filters/base.rb', line 4

def column_name
  @column_name
end

#featureObject (readonly)

Returns the value of attribute feature.



4
5
6
# File 'lib/queryko/filters/base.rb', line 4

def feature
  @feature
end

#fieldObject (readonly)

Returns the value of attribute field.



4
5
6
# File 'lib/queryko/filters/base.rb', line 4

def field
  @field
end

#query_objectObject (readonly)

Returns the value of attribute query_object.



4
5
6
# File 'lib/queryko/filters/base.rb', line 4

def query_object
  @query_object
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



4
5
6
# File 'lib/queryko/filters/base.rb', line 4

def table_name
  @table_name
end

Instance Method Details

#call(collection, token, query_object) ⇒ Object



13
14
15
16
17
18
# File 'lib/queryko/filters/base.rb', line 13

def call(collection, token, query_object)
  @query_object = query_object
  @table_name ||= query_object.class.table_name

  perform(collection, token, query_object)
end

#param_key_formatObject



24
25
26
# File 'lib/queryko/filters/base.rb', line 24

def param_key_format
  nil
end