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.
165 166 167 |
# File 'lib/sunspot/util.rb', line 165 def initialize(coords) @coords = coords end |
Instance Method Details
#lat ⇒ Object
169 170 171 172 173 174 175 |
# File 'lib/sunspot/util.rb', line 169 def lat if @coords.respond_to?(:[]) @coords[0] else @coords.lat end.to_f end |
#lng ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/sunspot/util.rb', line 177 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 |