Class: Fitreader::FitFile
- Inherits:
-
Object
- Object
- Fitreader::FitFile
- Defined in:
- lib/fitreader/fitfile.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
-
#initialize(path) ⇒ FitFile
constructor
A new instance of FitFile.
Constructor Details
#initialize(path) ⇒ FitFile
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fitreader/fitfile.rb', line 13 def initialize(path) if path.is_a? String @file = File.open(path, 'rb') elsif path.is_a? File @file = path end @header = FileHeader.new(@file.read(14)) if valid? @defs = {} @messages = {} process_next_record while @file.pos < @header.num_records end end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
11 12 13 |
# File 'lib/fitreader/fitfile.rb', line 11 def file @file end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
11 12 13 |
# File 'lib/fitreader/fitfile.rb', line 11 def header @header end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
11 12 13 |
# File 'lib/fitreader/fitfile.rb', line 11 def @messages end |