Project

tcx

0.0
The project is in a healthy, maintained state
A Garmin Training Center XML (TCX) reader/writer.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

TCX

Gem Version Test

A Garmin Training Center XML (.TCX) reader and writer.

Unlike other libraries such as tcx_rb or tcxread, provides a more idiomatic API, implements both read and write, and supports the entire TCX schema, including extensions.

Installation

Add to Gemfile.

gem 'tcx'

Run bundle install.

Usage

Working with Files

Read and write TCX files using Tcx#load_file and dump.

require 'tcx'

tcx = Tcx.load_file('activities.tcx') # => Tcx::Database

tcx.activities # => [Tcx::Activity], array of Tcx::Activity
tcx.workouts # => [Tcx::Workout]
tcx.courses # => [Tcx::Course]

tcx.dump # overwrites activities.tcx

tcx.dump('activities2.tcx') # writes to activities2.tcx

Working with XML Data

Directly manipulate TCX data without creating files.

data = File.read('activities.tcx') # String

tcx = Tcx.load(data) # => Tcx::Database

tcx.to_xml # => XML string

tcx.dump('activities2.tcx') # writes to activities2.tcx

Examples

See examples for a complete set of working samples.

Upgrading

See UPGRADING.

Contributing

See CONTRIBUTING.

Copyright and License

Copyright (c) 2025, Daniel Doubrovkine and Contributors.

This project is licensed under the MIT License.