Sha256: 7b4045d951cf2b458f46898fbd8470c3f556c62f68195e0748c21447d9dce30e

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

require 'importer/garmin'
require 'importer/polar'
require 'importer/suunto'
require 'importer/gpx'
require 'importer/timex'

module Importer
	def Importer.file_type(name)
		case name
		when /\.tcx$/i
			return "GARMIN_XML" 
		when /\.hrm$/i
			return "POLAR_HRM"
		when /\.sdf$/i
			return "SUUNTO"
		when /\.gpx$/i
			return "GPX"
		when /\.csv$/i
		  f = File.new(name)
		  first_line = f.readline
		  f.close
		  if first_line.chomp == "[Timex Trainer Data File]"
		    return "TIMEX"
	    else
	      return "UNKNOWN CSV"
      end
		end
	end

	def Importer.read_in_file(name)
		if File.readable?(name)
			return open(name, "r")
		else 
			puts "FILE ERROR, can't read #{name}"
		end
	end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
teich-hrmparser-0.6.0 lib/hrmparser/importer.rb
hrmparser-0.7.0 lib/hrmparser/importer.rb
hrmparser-0.6.0 lib/hrmparser/importer.rb