Class: GPXReader::Point
- Inherits:
-
Object
- Object
- GPXReader::Point
- Defined in:
- lib/gpx_reader/point.rb
Instance Attribute Summary collapse
-
#elevation ⇒ Object
Returns the value of attribute elevation.
-
#hr ⇒ Object
Returns the value of attribute hr.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(point) ⇒ Point
constructor
A new instance of Point.
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
#elevation ⇒ Object
Returns the value of attribute elevation.
25 26 27 |
# File 'lib/gpx_reader/point.rb', line 25 def elevation @elevation end |
#hr ⇒ Object
Returns the value of attribute hr.
25 26 27 |
# File 'lib/gpx_reader/point.rb', line 25 def hr @hr end |
#lat ⇒ Object
Returns the value of attribute lat.
25 26 27 |
# File 'lib/gpx_reader/point.rb', line 25 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
25 26 27 |
# File 'lib/gpx_reader/point.rb', line 25 def lon @lon end |
#time ⇒ Object
Returns the value of attribute time.
25 26 27 |
# File 'lib/gpx_reader/point.rb', line 25 def time @time end |