Class: Gooby::Track
- Inherits:
-
GoobyObject
- Object
- GoobyObject
- Gooby::Track
- Defined in:
- lib/gooby_track.rb
Overview
Instances of this class represent a <Track> aggregate object from a Forerunner
XML file. Note that a <Run> may contain more than one <Track> aggregates.
Instance Attribute Summary collapse
-
#descr ⇒ Object
readonly
Returns the value of attribute descr.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#trackpoints ⇒ Object
readonly
Returns the value of attribute trackpoints.
Instance Method Summary collapse
- #add_trackpoint(tkpt) ⇒ Object
- #dump ⇒ Object
-
#initialize(num = 0, descr = '') ⇒ Track
constructor
A new instance of Track.
- #size ⇒ Object
- #to_s ⇒ Object
Methods included from GoobyKernel
#character_align, #default_delimiter, #invalid_altitude, #invalid_heartbeat, #invalid_latitude, #invalid_longitude, #invalid_time, #project_author, #project_copyright, #project_date, #project_embedded_comment, #project_license, #project_name, #project_version_number, #project_year, #read_as_ascii_lines, #read_lines, #strip_lines, #tokenize
Constructor Details
#initialize(num = 0, descr = '') ⇒ Track
Returns a new instance of Track.
20 21 22 23 24 |
# File 'lib/gooby_track.rb', line 20 def initialize(num=0, descr='') @number = num @descr = descr @trackpoints = Array.new end |
Instance Attribute Details
#descr ⇒ Object (readonly)
Returns the value of attribute descr.
18 19 20 |
# File 'lib/gooby_track.rb', line 18 def descr @descr end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
18 19 20 |
# File 'lib/gooby_track.rb', line 18 def number @number end |
#trackpoints ⇒ Object (readonly)
Returns the value of attribute trackpoints.
18 19 20 |
# File 'lib/gooby_track.rb', line 18 def trackpoints @trackpoints end |
Instance Method Details
#add_trackpoint(tkpt) ⇒ Object
28 29 30 |
# File 'lib/gooby_track.rb', line 28 def add_trackpoint(tkpt) @trackpoints.push(tkpt) end |
#dump ⇒ Object
40 41 42 43 |
# File 'lib/gooby_track.rb', line 40 def dump puts "Track: '#{@descr}' tkpts: #{size}" @trackpoints.each { |tkpt| puts tkpt.to_csv } end |
#size ⇒ Object
32 33 34 |
# File 'lib/gooby_track.rb', line 32 def size @trackpoints.size end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/gooby_track.rb', line 36 def to_s return "Trk: #{@descr} tkpts: #{size}" end |