Class: Sunspot::FieldFactory::Coordinates
- Inherits:
-
Object
- Object
- Sunspot::FieldFactory::Coordinates
- Defined in:
- lib/sunspot/field_factory.rb
Overview
XXX Right now this doubles as a Field and a FieldFactory - good idea?
Instance Method Summary collapse
-
#initialize(name) ⇒ Coordinates
constructor
A new instance of Coordinates.
- #populate_document(document, model) ⇒ Object
Constructor Details
#initialize(name) ⇒ Coordinates
Returns a new instance of Coordinates.
128 129 130 |
# File 'lib/sunspot/field_factory.rb', line 128 def initialize(name) @data_extractor = DataExtractor::AttributeExtractor.new(name) end |
Instance Method Details
#populate_document(document, model) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/sunspot/field_factory.rb', line 132 def populate_document(document, model) if coordinates = @data_extractor.value_for(model) coordinates = Util::Coordinates.new(coordinates) document.add_field(:lat, coordinates.lat) document.add_field(:long, coordinates.lng) end end |