Sha256: 4aee6334e95d49864ed25f3e65f960d05cc173d461d21fd3b673e1553982de1c
Contents?: true
Size: 957 Bytes
Versions: 12
Compression:
Stored size: 957 Bytes
Contents
class ThinkingSphinx::ActiveRecord::Attribute::SphinxPresenter SPHINX_TYPES = { :integer => :uint, :boolean => :bool, :timestamp => :timestamp, :float => :float, :string => :string, :bigint => :bigint, :ordinal => :str2ordinal, :wordcount => :str2wordcount } def initialize(attribute, source) @attribute, @source = attribute, source end def collection_type @attribute.multi? ? :multi : sphinx_type end def declaration if @attribute.multi? multi_declaration else @attribute.name end end def sphinx_type SPHINX_TYPES[@attribute.type] end private def multi_declaration case @attribute.source_type when :query, :ranged_query query else "#{sphinx_type} #{@attribute.name} from field" end end def query ThinkingSphinx::ActiveRecord::PropertyQuery.new( @attribute, @source, sphinx_type ).to_s end end
Version data entries
12 entries across 12 versions & 1 rubygems