Sha256: da64bcf8094a59eed9f861d556336e7b40b9d4ef66ae16a5dce8715994c92392

Contents?: true

Size: 739 Bytes

Versions: 1

Compression:

Stored size: 739 Bytes

Contents

module FitParser
  class File
    def self.read(io)
      new.read(io)
    end

    attr_reader :header, :records, :crc

    def initialize
      @records = []
    end

    def read(io)
      @header = Header.read(io)
      definitions = {}
      dev_definitions = {}
      while io.pos < @header.end_pos
        record = Record.new(definitions, dev_definitions)
        @records << record.read(io)
        content = record.content
        if content[:raw_field_0] == 0
          dev_definitions[content[:raw_field_0].to_s] ||= {}
          dev_definitions[content[:raw_field_0].to_s][content[:raw_field_1].to_s] = content
        end
        definitions = record.definitions
      end
      @crc = io.read(2)
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fit_parser-1.0.0 lib/fit_parser/file.rb