Class: Joule::PowerTap::Parser
- Inherits:
-
CSV::Parser
- Object
- Base::Parser
- CSV::Parser
- Joule::PowerTap::Parser
- Defined in:
- lib/joule/powertap/parser.rb
Constant Summary collapse
- MINUTES =
0
- TORQUE =
1
- SPEED =
2
- POWER =
3
- DISTANCE =
4
- CADENCE =
5
- HEARTRATE =
6
- MARKER =
7
Instance Attribute Summary
Attributes inherited from Base::Parser
Instance Method Summary collapse
Methods inherited from CSV::Parser
Methods included from UnitsConversion
#convert_distance, #convert_speed, #kilometers_per_hour_to_millimeters_per_second, #kilometers_to_millimeters, #miles_per_hour_to_millimeters_per_second, #miles_to_millimeters, #millimeters_per_second_to_kilometers_per_hour, #millimeters_per_second_to_miles_per_hour, #millimeters_to_kilometers, #millimeters_to_miles
Methods inherited from Base::Parser
#initialize, #parse, #parse_workout
Methods included from Calculator::PeakPowerCalculator
#calculate_peak_power_value, #calculate_peak_power_values
Methods included from Calculator::MarkerCalculator
#calculate_marker_averages, #calculate_marker_maximums, #calculate_marker_totals, #calculate_marker_training_metrics, #calculate_marker_values
Constructor Details
This class inherits a constructor from Joule::Base::Parser
Instance Method Details
#parse_properties ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/joule/powertap/parser.rb', line 13 def parse_properties() header = FasterCSV.parse(@data).shift records = FasterCSV.parse(@data) @workout.properties = Joule::PowerTap::Properties.new @workout.properties.speed_units = header[SPEED].to_s.downcase @workout.properties.power_units = header[POWER].to_s.downcase @workout.properties.distance_units = header[DISTANCE].to_s.downcase calculate_record_interval(records) end |