class ChewyQuery::Builder::Nodes::Equal

Constants

EXECUTION

Public Class Methods

new(name, value, *args) click to toggle source
# File lib/chewy_query/builder/nodes/equal.rb, line 16
def initialize(name, value, *args)
  @name = name.to_s
  @value = value
  @options = args.extract_options!
  execution = EXECUTION[args.first.to_sym] if args.first
  @options[:execution] = execution if execution
end

Public Instance Methods

__render__() click to toggle source
# File lib/chewy_query/builder/nodes/equal.rb, line 24
def __render__
  filter = (@value.is_a?(Array) ? :terms : :term)
  body = { @name => @value }
  body.merge!(@options.slice(:execution)) if filter == :terms
  body.merge!(_cache: !!@options[:cache]) if @options.key?(:cache)
  { filter => body }
end