Class: Sunspot::Query::Restriction::SameAs
- Defined in:
- lib/sunspot/query/restriction.rb
Overview
Result must be the exact instance given (only useful when negated).
Instance Method Summary collapse
-
#initialize(object, negated = false) ⇒ SameAs
constructor
A new instance of SameAs.
- #negate ⇒ Object
- #to_positive_boolean_phrase ⇒ Object
Methods inherited from Base
#negated?, #to_boolean_phrase, #to_negated_boolean_phrase, #to_params
Constructor Details
#initialize(object, negated = false) ⇒ SameAs
Returns a new instance of SameAs.
218 219 220 |
# File 'lib/sunspot/query/restriction.rb', line 218 def initialize(object, negated = false) @object, @negated = object, negated end |
Instance Method Details
#negate ⇒ Object
227 228 229 |
# File 'lib/sunspot/query/restriction.rb', line 227 def negate SameAs.new(@object, !negated?) end |
#to_positive_boolean_phrase ⇒ Object
222 223 224 225 |
# File 'lib/sunspot/query/restriction.rb', line 222 def to_positive_boolean_phrase adapter = Adapters::InstanceAdapter.adapt(@object) "id:#{escape(adapter.index_id)}" end |