Class: Nominatim::Point
- Inherits:
-
Object
- Object
- Nominatim::Point
- Defined in:
- lib/nominatim/point.rb
Instance Attribute Summary collapse
-
#lat ⇒ Object
(also: #latitude)
readonly
Returns the value of attribute lat.
-
#lon ⇒ Object
(also: #longitude)
readonly
Returns the value of attribute lon.
Instance Method Summary collapse
- #==(other) ⇒ true, false
-
#initialize(lat, lon) ⇒ Point
constructor
A new instance of Point.
- #to_a ⇒ Array
-
#to_s ⇒ String
Return a string representation of the point.
Constructor Details
#initialize(lat, lon) ⇒ Point
Returns a new instance of Point.
9 10 11 |
# File 'lib/nominatim/point.rb', line 9 def initialize(lat, lon) @lat, @lon = lat.to_f, lon.to_f if lat && lon end |
Instance Attribute Details
#lat ⇒ Object (readonly) Also known as: latitude
Returns the value of attribute lat.
3 4 5 |
# File 'lib/nominatim/point.rb', line 3 def lat @lat end |
#lon ⇒ Object (readonly) Also known as: longitude
Returns the value of attribute lon.
3 4 5 |
# File 'lib/nominatim/point.rb', line 3 def lon @lon end |
Instance Method Details
#==(other) ⇒ true, false
26 27 28 |
# File 'lib/nominatim/point.rb', line 26 def ==(other) self.to_a == other.to_a end |
#to_a ⇒ Array
14 15 16 |
# File 'lib/nominatim/point.rb', line 14 def to_a [lat, lon] end |
#to_s ⇒ String
Return a string representation of the point
21 22 23 |
# File 'lib/nominatim/point.rb', line 21 def to_s to_a.to_s end |