class ThinkingSphinx::ActiveRecord::Attribute::SphinxPresenter
Constants
- SPHINX_TYPES
Public Class Methods
new(attribute, source)
click to toggle source
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 16 def initialize(attribute, source) @attribute, @source = attribute, source end
Public Instance Methods
collection_type()
click to toggle source
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 20 def collection_type @attribute.multi? ? :multi : sphinx_type end
declaration()
click to toggle source
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 24 def declaration if @attribute.multi? multi_declaration else @attribute.name end end
sphinx_type()
click to toggle source
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 32 def sphinx_type SPHINX_TYPES[@attribute.type] end
Private Instance Methods
multi_declaration()
click to toggle source
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 38 def multi_declaration case @attribute.source_type when :query, :ranged_query query else "#{sphinx_type} #{@attribute.name} from field" end end
query()
click to toggle source
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 47 def query ThinkingSphinx::ActiveRecord::PropertyQuery.new( @attribute, @source, sphinx_type ).to_s end