Class: Tcxxxer::DB
- Inherits:
-
Object
- Object
- Tcxxxer::DB
- Defined in:
- lib/tcxxxer/db.rb
Class Method Summary collapse
Instance Method Summary collapse
- #course(course_id) ⇒ Object
- #courses ⇒ Object
-
#initialize(file) ⇒ DB
constructor
A new instance of DB.
- #parse ⇒ Object
Constructor Details
#initialize(file) ⇒ DB
Returns a new instance of DB.
22 23 24 |
# File 'lib/tcxxxer/db.rb', line 22 def initialize(file) @file_name = file end |
Class Method Details
.file_type(file_name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/tcxxxer/db.rb', line 3 def self.file_type(file_name) case File.extname(file_name).downcase when '.tcx' TCX when '.gpx' GPX when '.fit' FIT else raise "Unknown filetype" end end |
.open(file_name) ⇒ Object
16 17 18 19 20 |
# File 'lib/tcxxxer/db.rb', line 16 def self.open(file_name) db = new(file_name) db.parse return db end |
Instance Method Details
#course(course_id) ⇒ Object
41 42 43 |
# File 'lib/tcxxxer/db.rb', line 41 def course(course_id) @doc.courses(course_id) end |
#courses ⇒ Object
37 38 39 |
# File 'lib/tcxxxer/db.rb', line 37 def courses @doc.courses end |