Class: Fitreader::FitFile

Inherits:
Object
  • Object
show all
Defined in:
lib/fitreader/fitfile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FitFile

Returns a new instance of FitFile.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fitreader/fitfile.rb', line 13

def initialize(path)
  @file = File.open(path, 'rb')
  @header = FileHeader.new(@file.read(14))
  if valid?
    @defs = {}
    @messages = {}
    while @file.pos < @header.num_records do
      process_next_record
    end
    # puts "number of bad records found: #{@error_records.length}"
  end
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



11
12
13
# File 'lib/fitreader/fitfile.rb', line 11

def file
  @file
end

#headerObject (readonly)

Returns the value of attribute header.



11
12
13
# File 'lib/fitreader/fitfile.rb', line 11

def header
  @header
end

#messagesObject (readonly)

Returns the value of attribute messages.



11
12
13
# File 'lib/fitreader/fitfile.rb', line 11

def messages
  @messages
end