Class: Yaqb::QueryBuilders::Filter
- Inherits:
-
Object
- Object
- Yaqb::QueryBuilders::Filter
- Defined in:
- lib/yaqb/query_builders/filter.rb
Constant Summary collapse
- PREDICATES =
%w[eq cont notcont start end gt lt].freeze
Instance Method Summary collapse
- #filter ⇒ Object
-
#initialize(scope, params, presenter) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(scope, params, presenter) ⇒ Filter
Returns a new instance of Filter.
8 9 10 11 12 |
# File 'lib/yaqb/query_builders/filter.rb', line 8 def initialize(scope, params, presenter) @scope = scope @filters = params['q'] || {} @presenter = presenter end |
Instance Method Details
#filter ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/yaqb/query_builders/filter.rb', line 14 def filter return @scope unless @filters.any? @filters = format_filters validate_filters build_filter_scope @scope end |