Class: Fitreader::FieldDefinition
- Inherits:
-
Object
- Object
- Fitreader::FieldDefinition
- Defined in:
- lib/fitreader/field_definition.rb
Constant Summary collapse
- ENDIAN_ABILITY =
128- BASE_TYPE_NUM =
31
Instance Attribute Summary collapse
-
#base_num ⇒ Object
Returns the value of attribute base_num.
-
#def_num ⇒ Object
Returns the value of attribute def_num.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(msg_num, bytes) ⇒ FieldDefinition
constructor
A new instance of FieldDefinition.
Constructor Details
#initialize(msg_num, bytes) ⇒ FieldDefinition
Returns a new instance of FieldDefinition.
5 6 7 8 9 10 |
# File 'lib/fitreader/field_definition.rb', line 5 def initialize(msg_num, bytes) @def_num = bytes[0].unpack('C').first @size = bytes[1].unpack('C').first # @single_byte = bytes[2].unpack('C').first & ENDIAN_ABILITY == 0 @base_num = bytes[2].unpack('C').first & BASE_TYPE_NUM end |
Instance Attribute Details
#base_num ⇒ Object
Returns the value of attribute base_num.
3 4 5 |
# File 'lib/fitreader/field_definition.rb', line 3 def base_num @base_num end |
#def_num ⇒ Object
Returns the value of attribute def_num.
3 4 5 |
# File 'lib/fitreader/field_definition.rb', line 3 def def_num @def_num end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'lib/fitreader/field_definition.rb', line 3 def size @size end |