Class: ThinkingSphinx::ActiveRecord::Property
- Inherits:
-
Object
- Object
- ThinkingSphinx::ActiveRecord::Property
- Includes:
- Core::Property
- Defined in:
- lib/thinking_sphinx/active_record/property.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(model, columns, options = {}) ⇒ Property
constructor
A new instance of Property.
- #name ⇒ Object
- #rebase(associations, options) ⇒ Object
- #source_type ⇒ Object
Methods included from Core::Property
Constructor Details
#initialize(model, columns, options = {}) ⇒ Property
Returns a new instance of Property.
6 7 8 9 10 11 12 13 |
# File 'lib/thinking_sphinx/active_record/property.rb', line 6 def initialize(model, columns, = {}) @model, = model, @columns = Array(columns).collect { |column| column.respond_to?(:__name) ? column : ThinkingSphinx::ActiveRecord::Column.new(column) } end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
4 5 6 |
# File 'lib/thinking_sphinx/active_record/property.rb', line 4 def columns @columns end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/thinking_sphinx/active_record/property.rb', line 4 def end |
Instance Method Details
#name ⇒ Object
21 22 23 |
# File 'lib/thinking_sphinx/active_record/property.rb', line 21 def name ([:as] || columns.first.__name).to_s end |
#rebase(associations, options) ⇒ Object
15 16 17 18 19 |
# File 'lib/thinking_sphinx/active_record/property.rb', line 15 def rebase(associations, ) @columns = columns.inject([]) do |array, column| array + column.__replace(associations, [:to]) end end |
#source_type ⇒ Object
25 26 27 |
# File 'lib/thinking_sphinx/active_record/property.rb', line 25 def source_type [:source] end |