Class: Tcxxxer::TcxParser
- Inherits:
-
Object
- Object
- Tcxxxer::TcxParser
- Defined in:
- lib/tcxxxer/tcx_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
- #courses ⇒ Object
-
#initialize(file) ⇒ TcxParser
constructor
A new instance of TcxParser.
- #parse ⇒ Object
Constructor Details
#initialize(file) ⇒ TcxParser
Returns a new instance of TcxParser.
12 13 14 |
# File 'lib/tcxxxer/tcx_parser.rb', line 12 def initialize(file) @file = file end |
Class Method Details
.open(file) ⇒ Object
6 7 8 9 10 |
# File 'lib/tcxxxer/tcx_parser.rb', line 6 def self.open(file) tcx_parser = self.new(file) tcx_parser.parse tcx_parser end |
Instance Method Details
#courses ⇒ Object
23 24 25 26 27 |
# File 'lib/tcxxxer/tcx_parser.rb', line 23 def courses() @doc.xpath('//Courses').map do |course_node| build_course(course_node) end end |
#parse ⇒ Object
16 17 18 19 20 21 |
# File 'lib/tcxxxer/tcx_parser.rb', line 16 def parse f = File.open(@file) @doc = Nokogiri.XML(f.read) @doc.remove_namespaces! f.close end |