Class: GeoRb::Point
- Inherits:
-
Object
- Object
- GeoRb::Point
- Defined in:
- lib/geo_rb/point.rb
Instance Attribute Summary collapse
-
#altitude ⇒ Object
readonly
Returns the value of attribute altitude.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
Instance Method Summary collapse
-
#initialize(latitude = 0.0, longitude = 0.0, altitude = 0.0) ⇒ Point
constructor
A new instance of Point.
- #to_h ⇒ Object
Constructor Details
#initialize(latitude = 0.0, longitude = 0.0, altitude = 0.0) ⇒ Point
Returns a new instance of Point.
5 6 7 |
# File 'lib/geo_rb/point.rb', line 5 def initialize(latitude = 0.0, longitude = 0.0, altitude = 0.0) @latitude, @longitude, @altitude = normalize_coordinates(latitude, longitude, altitude) end |
Instance Attribute Details
#altitude ⇒ Object (readonly)
Returns the value of attribute altitude.
3 4 5 |
# File 'lib/geo_rb/point.rb', line 3 def altitude @altitude end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/geo_rb/point.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/geo_rb/point.rb', line 3 def longitude @longitude end |
Instance Method Details
#to_h ⇒ Object
9 10 11 12 13 |
# File 'lib/geo_rb/point.rb', line 9 def to_h instance_variables.map do |var| [var[1..].to_sym, instance_variable_get(var)] end.to_h end |