Class: Fitreader::MessageType
- Inherits:
-
Object
- Object
- Fitreader::MessageType
- Defined in:
- lib/fitreader/message_type.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#undefined_records ⇒ Object
Returns the value of attribute undefined_records.
Instance Method Summary collapse
- #error_fields ⇒ Object
-
#initialize(definition) ⇒ MessageType
constructor
A new instance of MessageType.
- #record_values ⇒ Object
Constructor Details
#initialize(definition) ⇒ MessageType
Returns a new instance of MessageType.
6 7 8 9 10 |
# File 'lib/fitreader/message_type.rb', line 6 def initialize(definition) @definition = definition @records = [] @undefined_records = [] end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
3 4 5 |
# File 'lib/fitreader/message_type.rb', line 3 def definition @definition end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
3 4 5 |
# File 'lib/fitreader/message_type.rb', line 3 def records @records end |
#undefined_records ⇒ Object
Returns the value of attribute undefined_records.
4 5 6 |
# File 'lib/fitreader/message_type.rb', line 4 def undefined_records @undefined_records end |
Instance Method Details
#error_fields ⇒ Object
18 19 20 21 22 |
# File 'lib/fitreader/message_type.rb', line 18 def error_fields records.flatten .select { |x| !x.error_fields.empty? } .collect(&:error_fields) end |
#record_values ⇒ Object
12 13 14 15 16 |
# File 'lib/fitreader/message_type.rb', line 12 def record_values records.flatten .collect { |y|y.fields.values.collect { |z| [z.name, z.value] } } .collect(&:to_h) end |