Class: Sunspot::DataExtractor::BlockExtractor
- Inherits:
-
Object
- Object
- Sunspot::DataExtractor::BlockExtractor
- Defined in:
- sunspot/lib/sunspot/data_extractor.rb
Overview
BlockExtractors extract data by evaluating a block in the context of the object instance, or if the block takes an argument, by passing the object as the argument to the block. Either way, the return value of the block is the value returned by the extractor.
Instance Method Summary (collapse)
-
- (BlockExtractor) initialize(&block)
constructor
A new instance of BlockExtractor.
- - (Object) value_for(object)
Constructor Details
- (BlockExtractor) initialize(&block)
A new instance of BlockExtractor
28 29 30 |
# File 'sunspot/lib/sunspot/data_extractor.rb', line 28 def initialize(&block) @block = block end |
Instance Method Details
- (Object) value_for(object)
32 33 34 |
# File 'sunspot/lib/sunspot/data_extractor.rb', line 32 def value_for(object) Util.instance_eval_or_call(object, &@block) end |