Class: Chewy::Query::Nodes::Bool
- Defined in:
- lib/chewy/query/nodes/bool.rb
Constant Summary collapse
- METHODS =
%w[must must_not should].freeze
Instance Method Summary collapse
- #__render__ ⇒ Object
-
#initialize(options = {}) ⇒ Bool
constructor
A new instance of Bool.
Methods inherited from Expr
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ Bool
Returns a new instance of Bool.
7 8 9 10 11 12 |
# File 'lib/chewy/query/nodes/bool.rb', line 7 def initialize( = {}) @options = @must = [] @must_not = [] @should = [] end |
Instance Method Details
#__render__ ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/chewy/query/nodes/bool.rb', line 21 def __render__ bool = { bool: Hash[METHODS.map do |method| value = instance_variable_get("@#{method}") [method.to_sym, value.map(&:__render__)] if value.present? end.compact] } bool[:bool][:_cache] = !!@options[:cache] if @options.key?(:cache) bool end |