Class: TCXReader::Tcx

Inherits:
Object
  • Object
show all
Defined in:
lib/tcx_reader/tcx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Tcx

read the file containing the tracks get the different information of the file get the tracks NOTE: removing name space may lead to some ambiguities



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/tcx_reader/tcx.rb', line 30

def initialize(file)
  if file.is_a?(File)
    @tcx=Nokogiri::XML(File.open(file)).remove_namespaces!
  else
    @tcx=Nokogiri::XML(file).remove_namespaces!
  end
  @activities = []
  @tcx.css("Activity").each do |act|
     act = Activity.new(act)
     @activities << act
  end
end

Instance Attribute Details

#activitiesObject

Returns the value of attribute activities.



25
26
27
# File 'lib/tcx_reader/tcx.rb', line 25

def activities
  @activities
end