Class: Chewie::Query::Bool
- Inherits:
-
Object
- Object
- Chewie::Query::Bool
- Includes:
- Utils
- Defined in:
- lib/chewie/query/bool.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#combine ⇒ Object
readonly
Returns the value of attribute combine.
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#query_format ⇒ Object
readonly
Returns the value of attribute query_format.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#with ⇒ Object
readonly
Returns the value of attribute with.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(handler, filters) ⇒ Bool
constructor
A new instance of Bool.
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) ⇒ Bool
Returns a new instance of Bool.
8 9 10 11 12 13 14 15 |
# File 'lib/chewie/query/bool.rb', line 8 def initialize(handler, filters) @attribute = handler[:attribute] @query_format = handler[:format] @with = handler[:with] @value = filters[attribute] @combine = handler[:combine] @filters = filters end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
6 7 8 |
# File 'lib/chewie/query/bool.rb', line 6 def attribute @attribute end |
#combine ⇒ Object (readonly)
Returns the value of attribute combine.
6 7 8 |
# File 'lib/chewie/query/bool.rb', line 6 def combine @combine end |
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
6 7 8 |
# File 'lib/chewie/query/bool.rb', line 6 def filters @filters end |
#query_format ⇒ Object (readonly)
Returns the value of attribute query_format.
6 7 8 |
# File 'lib/chewie/query/bool.rb', line 6 def query_format @query_format end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/chewie/query/bool.rb', line 6 def value @value end |
#with ⇒ Object (readonly)
Returns the value of attribute with.
6 7 8 |
# File 'lib/chewie/query/bool.rb', line 6 def with @with end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/chewie/query/bool.rb', line 17 def build return {} if value.nil? return [] if [value].flatten.empty? context(with) do { attribute => exposed_value } end end |