Module: TcxRb
- Defined in:
- lib/tcx_rb.rb,
lib/tcx_rb/lap.rb,
lib/tcx_rb/parser.rb,
lib/tcx_rb/version.rb,
lib/tcx_rb/workout.rb,
lib/tcx_rb/activity.rb,
lib/tcx_rb/trackpoint.rb
Defined Under Namespace
Classes: Activity, Error, Lap, Parser, Trackpoint, Workout
Constant Summary collapse
- VERSION =
'0.2.2'
Class Method Summary collapse
- .workout_from_file(path) ⇒ Object
-
.workout_from_str(tcx_str) ⇒ Object
Your code goes here…
Class Method Details
.workout_from_file(path) ⇒ Object
25 26 27 28 |
# File 'lib/tcx_rb.rb', line 25 def self.workout_from_file(path) str = File.read(path) workout_from_str(str) end |
.workout_from_str(tcx_str) ⇒ Object
Your code goes here…
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tcx_rb.rb', line 14 def self.workout_from_str(tcx_str) parser = TcxRb::Parser.new(tcx_str) workout = parser.parse_activities activities = workout.map do |activity| activity[:laps] = generate_laps(activity[:laps]) TcxRb::Activity.new(activity) end TcxRb::Workout.new(activities) end |