Class: ThinkingSphinx::ClassFacet

Inherits:
Facet
  • Object
show all
Defined in:
lib/thinking_sphinx/class_facet.rb

Instance Attribute Summary

Attributes inherited from Facet

#property, #value_source

Instance Method Summary collapse

Methods inherited from Facet

attribute_name_for, attribute_name_from_value, #float?, #initialize, name_for, #to_s, translate?, #translate?, #type

Constructor Details

This class inherits a constructor from ThinkingSphinx::Facet

Instance Method Details

#attribute_nameObject



7
8
9
# File 'lib/thinking_sphinx/class_facet.rb', line 7

def attribute_name
  Riddle.loaded_version.to_i < 2 ? 'class_crc' : 'sphinx_internal_class'
end

#nameObject



3
4
5
# File 'lib/thinking_sphinx/class_facet.rb', line 3

def name
  :class
end

#value(object, attribute_hash) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/thinking_sphinx/class_facet.rb', line 11

def value(object, attribute_hash)
  if Riddle.loaded_version.to_i < 2
    crc = attribute_hash['class_crc']
    ThinkingSphinx::Configuration.instance.models_by_crc[crc]
  else
    attribute_hash['sphinx_internal_class']
  end
end