Class: GpxDoctor::Models::Waypoint
- Inherits:
-
Object
- Object
- GpxDoctor::Models::Waypoint
- Defined in:
- lib/gpx_doctor/models/waypoint.rb
Constant Summary collapse
- FIELDS =
%i[ lat lon ele time magvar geoidheight name cmt desc src links sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid ].freeze
- STATISTICS_FIELDS =
%i[distance_to_next elevation_change direction].freeze
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Waypoint
constructor
A new instance of Waypoint.
- #to_h ⇒ Object
Constructor Details
#initialize(**attrs) ⇒ Waypoint
Returns a new instance of Waypoint.
17 18 19 20 |
# File 'lib/gpx_doctor/models/waypoint.rb', line 17 def initialize(**attrs) attrs.each { |k, v| public_send(:"#{k}=", v) } @links ||= [] end |
Instance Method Details
#to_h ⇒ Object
22 23 24 25 26 27 |
# File 'lib/gpx_doctor/models/waypoint.rb', line 22 def to_h (FIELDS + STATISTICS_FIELDS).each_with_object({}) do |field, hash| value = public_send(field) hash[field] = value unless value.nil? end end |