Class: Sunspot::Util::Coordinates
- Inherits:
-
Object
- Object
- Sunspot::Util::Coordinates
- Defined in:
- lib/sunspot/util.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(coords) ⇒ Coordinates
constructor
A new instance of Coordinates.
- #lat ⇒ Object
- #lng ⇒ Object
Constructor Details
#initialize(coords) ⇒ Coordinates
Returns a new instance of Coordinates.
185 186 187 |
# File 'lib/sunspot/util.rb', line 185 def initialize(coords) @coords = coords end |
Instance Method Details
#lat ⇒ Object
189 190 191 192 193 194 195 |
# File 'lib/sunspot/util.rb', line 189 def lat if @coords.respond_to?(:[]) @coords[0] else @coords.lat end.to_f end |
#lng ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/sunspot/util.rb', line 197 def lng if @coords.respond_to?(:[]) @coords[1] elsif @coords.respond_to?(:lng) @coords.lng elsif @coords.respond_to?(:lon) @coords.lon elsif @coords.respond_to?(:long) @coords.long end.to_f end |