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 => :timestamp, :float => :float, :string => :string, :bigint => :bigint, :ordinal => :str2ordinal, :wordcount => :str2wordcount }
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.
13 14 15 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 13 def initialize(attribute, source) @attribute, @source = attribute, source end |
Instance Method Details
#collection_type ⇒ Object
17 18 19 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 17 def collection_type @attribute.multi? ? :multi : sphinx_type end |
#declaration ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 21 def declaration if @attribute.multi? multi_declaration else @attribute.name end end |
#sphinx_type ⇒ Object
29 30 31 |
# File 'lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb', line 29 def sphinx_type SPHINX_TYPES[@attribute.type] end |