Class: Stretchy::Types::GeoPoint
- Defined in:
- lib/stretchy/types/geo_point.rb
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::Validation
#errors, included, #require_one!, #require_only_one!, #valid?, #validate!, #validator
Constructor Details
#initialize(options = {}) ⇒ GeoPoint
Returns a new instance of GeoPoint.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stretchy/types/geo_point.rb', line 17 def initialize( = {}) if .is_a?(self.class) @lat = .lat @lon = .lon else @lat = [:lat] || [:latitude] @lon = [:lng] || [:lon] || [:longitude] end validate! end |
Instance Attribute Details
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
15 16 17 |
# File 'lib/stretchy/types/geo_point.rb', line 15 def lat @lat end |
#lon ⇒ Object (readonly)
Returns the value of attribute lon.
15 16 17 |
# File 'lib/stretchy/types/geo_point.rb', line 15 def lon @lon end |
Instance Method Details
#to_search ⇒ Object
30 31 32 33 34 35 |
# File 'lib/stretchy/types/geo_point.rb', line 30 def to_search { lat: @lat, lon: @lon } end |