Class: Tracksperanto::Import::PFTrack

Inherits:
Base
  • Object
show all
Defined in:
lib/import/pftrack.rb

Instance Attribute Summary

Attributes inherited from Base

#height, #progress_block, #width

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

autodetects_size?, inherited, #report_progress

Methods included from ZipTuples

#zip_curve_tuples

Methods included from BlockInit

#initialize

Methods included from Casts

#cast_to_float, #cast_to_int, #cast_to_string, included

Methods included from Safety

included, #safe_reader

Class Method Details

.distinct_file_extObject



6
7
8
# File 'lib/import/pftrack.rb', line 6

def self.distinct_file_ext
  ".2dt"
end

.human_nameObject



2
3
4
# File 'lib/import/pftrack.rb', line 2

def self.human_name
  "PFTrack .2dt file"
end

Instance Method Details

#parse(io) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/import/pftrack.rb', line 10

def parse(io)
  trackers = []
  until io.eof?
    line = io.gets
    next unless line
    
    if line =~ /[AZaz]/ # Tracker with a name
      t = Tracksperanto::Tracker.new{|t| t.name = line.strip.gsub(/"/, '') }
      report_progress("Reading tracker #{t.name}")
      parse_tracker(t, io)
      trackers << t
    end
  end
  
  trackers
end