Class: Sunspot::FieldFactory::Abstract
- Inherits:
-
Object
- Object
- Sunspot::FieldFactory::Abstract
- Defined in:
- lib/sunspot/field_factory.rb
Overview
Base class for field factories.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, options = {}, &block) ⇒ Abstract
constructor
A new instance of Abstract.
-
#populate_document(document, model, options = {}) ⇒ Object
Extract the encapsulated field’s data from the given model and add it into the Solr document for indexing.
Constructor Details
#initialize(name, options = {}, &block) ⇒ Abstract
Returns a new instance of Abstract.
16 17 18 19 20 21 22 23 24 |
# File 'lib/sunspot/field_factory.rb', line 16 def initialize(name, = {}, &block) @name = name.to_sym @data_extractor = if block DataExtractor::BlockExtractor.new(&block) else DataExtractor::AttributeExtractor.new(.delete(:using) || name) end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/sunspot/field_factory.rb', line 14 def name @name end |
Instance Method Details
#populate_document(document, model, options = {}) ⇒ Object
Extract the encapsulated field’s data from the given model and add it into the Solr document for indexing. (noop here for joins)
30 31 |
# File 'lib/sunspot/field_factory.rb', line 30 def populate_document(document, model, = {}) #:nodoc: end |