Class: TCXReader::Lap
- Inherits:
-
Object
- Object
- TCXReader::Lap
- Defined in:
- lib/tcx_reader/lap.rb
Instance Attribute Summary collapse
-
#avg_hr ⇒ Object
Returns the value of attribute avg_hr.
-
#calories ⇒ Object
Returns the value of attribute calories.
-
#distance_meter ⇒ Object
Returns the value of attribute distance_meter.
-
#intensity ⇒ Object
Returns the value of attribute intensity.
-
#max_hr ⇒ Object
Returns the value of attribute max_hr.
-
#max_speed ⇒ Object
Returns the value of attribute max_speed.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#time_seconds ⇒ Object
Returns the value of attribute time_seconds.
-
#tracks ⇒ Object
Returns the value of attribute tracks.
-
#trigger_method ⇒ Object
Returns the value of attribute trigger_method.
Instance Method Summary collapse
-
#initialize(lap) ⇒ Lap
constructor
A new instance of Lap.
Constructor Details
#initialize(lap) ⇒ Lap
Returns a new instance of Lap.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tcx_reader/lap.rb', line 27 def initialize(lap) @start_time = Time.parse(lap["StartTime"]) @time_seconds = lap.at_css("TotalTimeSeconds").text.to_f rescue nil @distance_meter = lap.at_css("DistanceMeters").text.to_f rescue nil @max_speed = lap.at_css("MaximumSpeed").text.to_f rescue nil @calories = lap.at_css("Calories").text.to_i rescue nil @avg_hr = lap.at_css("AverageHeartRateBpm Value").text.to_i rescue nil @max_hr = lap.at_css("MaximumHeartRateBpm Value").text.to_i rescue nil @intensity = lap.at_css("Intensity").text rescue nil @trigger_method = lap.at_css("TriggerMethod").text rescue nil @tracks = [] lap.css("Track").each do |trk| trk = Track.new(trk) @tracks << trk end end |
Instance Attribute Details
#avg_hr ⇒ Object
Returns the value of attribute avg_hr.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def avg_hr @avg_hr end |
#calories ⇒ Object
Returns the value of attribute calories.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def calories @calories end |
#distance_meter ⇒ Object
Returns the value of attribute distance_meter.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def distance_meter @distance_meter end |
#intensity ⇒ Object
Returns the value of attribute intensity.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def intensity @intensity end |
#max_hr ⇒ Object
Returns the value of attribute max_hr.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def max_hr @max_hr end |
#max_speed ⇒ Object
Returns the value of attribute max_speed.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def max_speed @max_speed end |
#start_time ⇒ Object
Returns the value of attribute start_time.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def start_time @start_time end |
#time_seconds ⇒ Object
Returns the value of attribute time_seconds.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def time_seconds @time_seconds end |
#tracks ⇒ Object
Returns the value of attribute tracks.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def tracks @tracks end |
#trigger_method ⇒ Object
Returns the value of attribute trigger_method.
25 26 27 |
# File 'lib/tcx_reader/lap.rb', line 25 def trigger_method @trigger_method end |