Class: Fitreader::RecordHeader
- Inherits:
-
Object
- Object
- Fitreader::RecordHeader
- Defined in:
- lib/fitreader/record_header.rb
Instance Attribute Summary collapse
-
#developer ⇒ Object
Returns the value of attribute developer.
-
#header_type ⇒ Object
Returns the value of attribute header_type.
-
#local_num ⇒ Object
Returns the value of attribute local_num.
-
#timestamp_offset ⇒ Object
Returns the value of attribute timestamp_offset.
Instance Method Summary collapse
-
#initialize(byte) ⇒ RecordHeader
constructor
A new instance of RecordHeader.
Constructor Details
#initialize(byte) ⇒ RecordHeader
Returns a new instance of RecordHeader.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fitreader/record_header.rb', line 6 def initialize(byte) timstamp_header = byte & TIMESTAMP_RECORD > 0 unless timstamp_header @header_type = byte & DEFINITION_MESSAGE > 0 ? :definition : :data @local_num = byte & NORMAL_TYPE if byte & DEVELOPER_DATA == DEVELOPER_DATA @developer = true puts "developer" end else @header_type = :timestamp @local_num = byte & TIMESTAMP_TYPE = byte & TIMESTAMP_OFFSET puts "timestamp header: #{@local_msg_num} :: #{@timestamp_offset}" end end |
Instance Attribute Details
#developer ⇒ Object
Returns the value of attribute developer.
3 4 5 |
# File 'lib/fitreader/record_header.rb', line 3 def developer @developer end |
#header_type ⇒ Object
Returns the value of attribute header_type.
3 4 5 |
# File 'lib/fitreader/record_header.rb', line 3 def header_type @header_type end |
#local_num ⇒ Object
Returns the value of attribute local_num.
3 4 5 |
# File 'lib/fitreader/record_header.rb', line 3 def local_num @local_num end |
#timestamp_offset ⇒ Object
Returns the value of attribute timestamp_offset.
3 4 5 |
# File 'lib/fitreader/record_header.rb', line 3 def end |