Class: Sunspot::FacetData::Abstract
- Inherits:
-
Object
- Object
- Sunspot::FacetData::Abstract
- Defined in:
- lib/sunspot/facet_data.rb
Overview
Base class for facet data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#cast(value) ⇒ Object
Cast the given value to the field’s type, if it has one; otherwise just return the string.
-
#reference ⇒ Object
The class that the field references, if any.
-
#row_value(value) ⇒ Object
Given the raw facet row value, return what the Sunspot facet row object should present as the value.
Instance Attribute Details
#field ⇒ Object (readonly)
:nodoc:
14 15 16 |
# File 'lib/sunspot/facet_data.rb', line 14 def field @field end |
Instance Method Details
#cast(value) ⇒ Object
Cast the given value to the field’s type, if it has one; otherwise just return the string.
27 28 29 30 31 32 33 |
# File 'lib/sunspot/facet_data.rb', line 27 def cast(value) if @field @field.cast(value) else value end end |
#reference ⇒ Object
The class that the field references, if any.
19 20 21 |
# File 'lib/sunspot/facet_data.rb', line 19 def reference @field.reference if @field end |
#row_value(value) ⇒ Object
Given the raw facet row value, return what the Sunspot facet row object should present as the value. This can be overridden by subclasses.
39 40 41 |
# File 'lib/sunspot/facet_data.rb', line 39 def row_value(value) cast(value) end |