Class: Sunspot::Query::ConstantFunctionQuery

Inherits:
FunctionQuery show all
Defined in:
lib/sunspot/query/function_query.rb

Overview

Function query which represents a constant.

Instance Attribute Summary collapse

Attributes inherited from FunctionQuery

#boost_amount

Instance Method Summary collapse

Methods inherited from FunctionQuery

#^

Constructor Details

#initialize(constant) ⇒ ConstantFunctionQuery

Returns a new instance of ConstantFunctionQuery.



25
26
27
# File 'lib/sunspot/query/function_query.rb', line 25

def initialize(constant)
  @constant = constant
end

Instance Attribute Details

#constantObject (readonly)

Returns the value of attribute constant.



23
24
25
# File 'lib/sunspot/query/function_query.rb', line 23

def constant
  @constant
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
# File 'lib/sunspot/query/function_query.rb', line 33

def ==(other)
  super and @constant == other.constant
end

#to_sObject



29
30
31
# File 'lib/sunspot/query/function_query.rb', line 29

def to_s
  Type.to_literal(@constant) << (@boost_amount ? "^#{@boost_amount}" : "")
end