Class: Headmin::Filter::Search

Inherits:
Base
  • Object
show all
Defined in:
app/models/headmin/filter/search.rb

Constant Summary

Constants inherited from Base

Base::OPERATORS, Base::OPERATORS_CONVERT_TO, Base::QUERY_OPERATOR_CONVERT_TO, Base::QUERY_VALUE_CONVERT_TO

Instance Attribute Summary

Attributes inherited from Base

#attribute, #instructions, #raw_value

Instance Method Summary collapse

Methods inherited from Base

#build_query, #conditionals, #initialize, #is_i?, #operators, #string, #values

Constructor Details

This class inherits a constructor from Headmin::Filter::Base

Instance Method Details

#cast_value(value) ⇒ Object



9
10
11
# File 'app/models/headmin/filter/search.rb', line 9

def cast_value(value)
  value
end

#display_value(value) ⇒ Object



13
14
15
# File 'app/models/headmin/filter/search.rb', line 13

def display_value(value)
  value.downcase
end

#query(collection) ⇒ Object



4
5
6
7
# File 'app/models/headmin/filter/search.rb', line 4

def query(collection)
  return collection unless @instructions.any?
  collection.search(raw_value)
end