Class: Sunspot::DataExtractor::AttributeExtractor

Inherits:
Object
  • Object
show all
Defined in:
sunspot/lib/sunspot/data_extractor.rb

Overview

AttributeExtractors extract data by simply calling a method on the block.

Instance Method Summary (collapse)

Constructor Details

- (AttributeExtractor) initialize(attribute_name)

A new instance of AttributeExtractor



12
13
14
# File 'sunspot/lib/sunspot/data_extractor.rb', line 12

def initialize(attribute_name)
  @attribute_name = attribute_name
end

Instance Method Details

- (Object) value_for(object)



16
17
18
# File 'sunspot/lib/sunspot/data_extractor.rb', line 16

def value_for(object)
  object.send(@attribute_name)
end