Class: Chewy::Query::Nodes::Not

Inherits:
Expr show all
Defined in:
lib/chewy/query/nodes/not.rb

Instance Method Summary collapse

Methods inherited from Expr

#&, #|, #~

Methods inherited from Base

#eql?, #render

Constructor Details

#initialize(expr, options = {}) ⇒ Not

Returns a new instance of Not.



5
6
7
8
# File 'lib/chewy/query/nodes/not.rb', line 5

def initialize(expr, options = {})
  @expr = expr
  @options = options
end

Instance Method Details

#!Object



10
11
12
# File 'lib/chewy/query/nodes/not.rb', line 10

def !
  @expr
end

#__render__Object



14
15
16
17
18
19
20
21
# File 'lib/chewy/query/nodes/not.rb', line 14

def __render__
  expr = @expr.__render__
  if @options.key?(:cache)
    {not: {filter: expr, _cache: !!@options[:cache]}}
  else
    {not: expr}
  end
end