Class: Elasticquery::Filters::Not

Inherits:
Base
  • Object
show all
Defined in:
lib/elasticquery/filters/not.rb

Instance Attribute Summary

Attributes inherited from Base

#params, #query

Instance Method Summary collapse

Methods inherited from Base

#build, build, #filterable?, filtered

Methods included from Builder

#exists, #filters, #missing, #multi_match, #not, #queries, #range, #search, #term, #terms, #where, #with, #without

Constructor Details

#initialize(*args) ⇒ Not

Returns a new instance of Not.



7
8
9
# File 'lib/elasticquery/filters/not.rb', line 7

def initialize(*args)
  @args = Marshal.load(Marshal.dump(args))
end

Instance Method Details

#dup_with(*args) ⇒ Object

Raises:

  • (StandardError)


11
12
13
# File 'lib/elasticquery/filters/not.rb', line 11

def dup_with(*args)
  raise StandardError, "Cannot use Filters::Not twice"
end

#to_hashObject



20
21
22
23
# File 'lib/elasticquery/filters/not.rb', line 20

def to_hash
  args = @args
  -> { filters[-2].dup_with(*args).to_not_hash }
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/elasticquery/filters/not.rb', line 15

def valid?
  args = @args
  -> { filters[-2].dup_with(*args).valid? }
end