Class: Sunspot::DataExtractor::AttributeExtractor
- Inherits:
-
Object
- Object
- Sunspot::DataExtractor::AttributeExtractor
- Defined in:
- lib/sunspot/data_extractor.rb
Overview
AttributeExtractors extract data by simply calling a method on the block.
Instance Method Summary collapse
-
#initialize(attribute_name) ⇒ AttributeExtractor
constructor
A new instance of AttributeExtractor.
- #value_for(object) ⇒ Object
Constructor Details
#initialize(attribute_name) ⇒ AttributeExtractor
Returns a new instance of AttributeExtractor.
12 13 14 |
# File 'lib/sunspot/data_extractor.rb', line 12 def initialize(attribute_name) @attribute_name = attribute_name end |
Instance Method Details
#value_for(object) ⇒ Object
16 17 18 |
# File 'lib/sunspot/data_extractor.rb', line 16 def value_for(object) object.send(@attribute_name) end |