Class: Stretchy::Types::GeoPoint
- Defined in:
- lib/stretchy/types/geo_point.rb
Constant Summary
Constants included from Utils::Contract
Utils::Contract::ASSERTIONS, Utils::Contract::DECAY_FUNCTIONS, Utils::Contract::DISTANCE_FORMAT
Instance Attribute Summary collapse
-
#lat ⇒ Object
readonly
Returns the value of attribute lat.
-
#lon ⇒ Object
readonly
Returns the value of attribute lon.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ GeoPoint
constructor
A new instance of GeoPoint.
- #to_search ⇒ Object
Methods included from Utils::Contract
included, #require_one, #validate!
Constructor Details
#initialize(options = {}) ⇒ GeoPoint
Returns a new instance of GeoPoint.
13 14 15 16 17 18 19 |
# File 'lib/stretchy/types/geo_point.rb', line 13 def initialize( = {}) @lat = [:lat] || [:latitude] @lon = [:lng] || [:lon] || [:longitude] validate! end |
Instance Attribute Details
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
7 8 9 |
# File 'lib/stretchy/types/geo_point.rb', line 7 def lat @lat end |
#lon ⇒ Object (readonly)
Returns the value of attribute lon.
7 8 9 |
# File 'lib/stretchy/types/geo_point.rb', line 7 def lon @lon end |
Instance Method Details
#to_search ⇒ Object
21 22 23 24 25 26 |
# File 'lib/stretchy/types/geo_point.rb', line 21 def to_search { lat: @lat, lon: @lon } end |