Class: Chewy::Query::Nodes::Prefix

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

Instance Method Summary collapse

Methods inherited from Expr

#!, #&, #|, #~

Methods inherited from Base

#eql?, #render

Constructor Details

#initialize(name, value, options = {}) ⇒ Prefix

Returns a new instance of Prefix.



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

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

Instance Method Details

#__render__Object



11
12
13
14
15
# File 'lib/chewy/query/nodes/prefix.rb', line 11

def __render__
  filter = {prefix: {@name => @value}}
  filter[:prefix][:_cache] = !!@options[:cache] if @options.key?(:cache)
  filter
end