Class: Chewie::Query::TermLevel
- Inherits:
-
Object
- Object
- Chewie::Query::TermLevel
- Includes:
- Utils
- Defined in:
- lib/chewie/query/term_level.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#clause ⇒ Object
readonly
Returns the value of attribute clause.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(handler, filters) ⇒ TermLevel
constructor
A new instance of TermLevel.
Methods included from Utils
#clean_filters, #combine_values, #context, #expose_or_return_value, #format_values, #reduce_handlers, #set_handler, #set_query_data
Constructor Details
#initialize(handler, filters) ⇒ TermLevel
Returns a new instance of TermLevel.
8 9 10 11 12 13 14 15 |
# File 'lib/chewie/query/term_level.rb', line 8 def initialize(handler, filters) @attribute = handler[:attribute] @query = handler[:query] @clause = handler[:clause] @value = filters[attribute] || filters[:query] = handler.fetch(:options, {}) @strategy = clause.present? ? 'clause' : 'attribute' end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
6 7 8 |
# File 'lib/chewie/query/term_level.rb', line 6 def attribute @attribute end |
#clause ⇒ Object (readonly)
Returns the value of attribute clause.
6 7 8 |
# File 'lib/chewie/query/term_level.rb', line 6 def clause @clause end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/chewie/query/term_level.rb', line 6 def end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
6 7 8 |
# File 'lib/chewie/query/term_level.rb', line 6 def query @query end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
6 7 8 |
# File 'lib/chewie/query/term_level.rb', line 6 def strategy @strategy end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/chewie/query/term_level.rb', line 6 def value @value end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 |
# File 'lib/chewie/query/term_level.rb', line 17 def build return {} if value.nil? return [] if [value].flatten.empty? send("create_with_#{strategy}") end |