Class: GPXReader::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/gpx_reader/point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(point) ⇒ Point

Returns a new instance of Point.



27
28
29
30
31
32
33
# File 'lib/gpx_reader/point.rb', line 27

def initialize(point)
  @lat = point["lat"].to_f rescue nil
  @lon = point["lon"].to_f rescue nil
  @elevation = point.at_css("ele").text.to_f rescue nil
  @time = Time.parse(point.at_css("time").text) rescue nil
  @hr = point.at_xpath(".//gpxtpx:hr").text.to_i rescue nil
end

Instance Attribute Details

#elevationObject

Returns the value of attribute elevation.



25
26
27
# File 'lib/gpx_reader/point.rb', line 25

def elevation
  @elevation
end

#hrObject

Returns the value of attribute hr.



25
26
27
# File 'lib/gpx_reader/point.rb', line 25

def hr
  @hr
end

#latObject

Returns the value of attribute lat.



25
26
27
# File 'lib/gpx_reader/point.rb', line 25

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



25
26
27
# File 'lib/gpx_reader/point.rb', line 25

def lon
  @lon
end

#timeObject

Returns the value of attribute time.



25
26
27
# File 'lib/gpx_reader/point.rb', line 25

def time
  @time
end