Class: ThinkingSphinx::ActiveRecord::Attribute::SphinxPresenter
- Inherits:
-
Object
- Object
- ThinkingSphinx::ActiveRecord::Attribute::SphinxPresenter
- Defined in:
- lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb
Constant Summary collapse
- SPHINX_TYPES =
{ :integer => :uint, :boolean => :bool, :timestamp => :uint, :float => :float, :string => :string, :bigint => :bigint, :ordinal => :str2ordinal, :wordcount => :str2wordcount, :json => :json }
Instance Method Summary collapse
- #collection_type ⇒ Object
- #declaration ⇒ Object
-
#initialize(attribute, source) ⇒ SphinxPresenter
constructor
A new instance of SphinxPresenter.
- #sphinx_type ⇒ Object
Constructor Details
#initialize(attribute, source) ⇒ SphinxPresenter
Returns a new instance of SphinxPresenter.
16 17 18 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 16 def initialize(attribute, source) @attribute, @source = attribute, source end |
Instance Method Details
#collection_type ⇒ Object
20 21 22 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 20 def collection_type @attribute.multi? ? :multi : sphinx_type end |
#declaration ⇒ Object
24 25 26 27 28 29 30 |
# 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 ⇒ Object
32 33 34 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 32 def sphinx_type SPHINX_TYPES[@attribute.type] end |