Class: TCXReader::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/tcx_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
34
35
# File 'lib/tcx_reader/point.rb', line 27

def initialize(point)
  @time     = Time.parse(point.at_css("Time"))
  @lat      = point.at_css("Position LatitudeDegrees").text.to_f rescue nil
  @lon      = point.at_css("Position LongitudeDegrees").text.to_f rescue nil
  @hr       = point.at_css("HeartRateBpm Value").text.to_i rescue nil
  @distance = point.at_css("DistanceMeters").text.to_f rescue nil
  @speed    = point.at_css("Speed").text.to_f rescue nil
  @cadence  = point.at_css("RunCadence").text.to_i rescue nil
end

Instance Attribute Details

#cadenceObject

Returns the value of attribute cadence.



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

def cadence
  @cadence
end

#distanceObject

Returns the value of attribute distance.



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

def distance
  @distance
end

#hrObject

Returns the value of attribute hr.



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

def hr
  @hr
end

#latObject

Returns the value of attribute lat.



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

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



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

def lon
  @lon
end

#speedObject

Returns the value of attribute speed.



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

def speed
  @speed
end

#timeObject

Returns the value of attribute time.



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

def time
  @time
end