Class: Natour::GPSTrackPoint

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/natour/gps_track_point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(latitude, longitude, elevation, time) ⇒ GPSTrackPoint

Returns a new instance of GPSTrackPoint.



8
9
10
11
12
13
# File 'lib/natour/gps_track_point.rb', line 8

def initialize(latitude, longitude, elevation, time)
  @latitude = latitude
  @longitude = longitude
  @elevation = elevation
  @time = time
end

Instance Attribute Details

#elevationObject (readonly)

Returns the value of attribute elevation.



5
6
7
# File 'lib/natour/gps_track_point.rb', line 5

def elevation
  @elevation
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



3
4
5
# File 'lib/natour/gps_track_point.rb', line 3

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



4
5
6
# File 'lib/natour/gps_track_point.rb', line 4

def longitude
  @longitude
end

#timeObject (readonly)

Returns the value of attribute time.



6
7
8
# File 'lib/natour/gps_track_point.rb', line 6

def time
  @time
end

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
20
# File 'lib/natour/gps_track_point.rb', line 17

def <=>(other)
  [@latitude, @longitude, @elevation, @time] <=>
    [other.latitude, other.longitude, other.elevation, other.time]
end

#hashObject



22
23
24
# File 'lib/natour/gps_track_point.rb', line 22

def hash
  [@latitude, @longitude, @elevation, @time].hash
end