Class: Chewy::Query::Nodes::Exists

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

Instance Method Summary collapse

Methods inherited from Expr

#&, #|, #~

Methods inherited from Base

#eql?, #render

Constructor Details

#initialize(name, options = {}) ⇒ Exists

Returns a new instance of Exists.



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

def initialize(name, options = {})
  @name = name.to_s
  @options = options
end

Instance Method Details

#!Object



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

def !
  Nodes::Missing.new @name, null_value: true
end

#__render__Object



14
15
16
# File 'lib/chewy/query/nodes/exists.rb', line 14

def __render__
  {exists: {field: @name}}
end