Sha256: 5759bb8b1e8a93ea0b894d3271919805d0a57a12000b8bc3f1eb88bceda1f1c2
Contents?: true
Size: 982 Bytes
Versions: 6
Compression:
Stored size: 982 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, :json => :json } 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
6 entries across 6 versions & 1 rubygems