Class: ThinkingSphinx::ActiveRecord::Attribute::Type
- Inherits:
-
Object
- Object
- ThinkingSphinx::ActiveRecord::Attribute::Type
- Defined in:
- lib/thinking_sphinx/active_record/attribute/type.rb
Constant Summary collapse
- UPDATEABLE_TYPES =
[:integer, :timestamp, :boolean, :float]
Instance Method Summary collapse
-
#initialize(attribute, model) ⇒ Type
constructor
A new instance of Type.
- #multi? ⇒ Boolean
- #timestamp? ⇒ Boolean
- #type ⇒ Object
- #type=(value) ⇒ Object
- #updateable? ⇒ Boolean
Constructor Details
#initialize(attribute, model) ⇒ Type
Returns a new instance of Type.
6 7 8 |
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 6 def initialize(attribute, model) @attribute, @model = attribute, model end |
Instance Method Details
#multi? ⇒ Boolean
10 11 12 |
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 10 def multi? @multi ||= attribute.[:multi] || multi_from_associations end |
#timestamp? ⇒ Boolean
14 15 16 |
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 14 def type == :timestamp end |
#type ⇒ Object
18 19 20 |
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 18 def type @type ||= attribute.[:type] || type_from_database end |
#type=(value) ⇒ Object
22 23 24 |
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 22 def type=(value) @type = attribute.[:type] = value end |
#updateable? ⇒ Boolean
26 27 28 |
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 26 def updateable? UPDATEABLE_TYPES.include?(type) && single_column_reference? end |