Class: ChewyQuery::Builder::Nodes::Prefix

Inherits:
Expr
  • Object
show all
Defined in:
lib/chewy_query/builder/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
# File 'lib/chewy_query/builder/nodes/prefix.rb', line 5

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

Instance Method Details

#__render__Object



10
11
12
13
14
# File 'lib/chewy_query/builder/nodes/prefix.rb', line 10

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