Class: Fit4Ruby::Metrics
- Inherits:
-
FitDataRecord
- Object
- FitDataRecord
- Fit4Ruby::Metrics
- Defined in:
- lib/fit4ruby/Metrics.rb
Overview
The Metrics object is a FIT file class. It’s a top-level object that holds all references to other FIT records that are part of the FIT file. Each of the objects it references are direct equivalents of the message record structures used in the FIT file.
This is not part of the officially documented FIT API. Names may change in the future if the real Garmin names get known.
Constant Summary
Constants inherited from FitDataRecord
Constants included from BDFieldNameTranslator
BDFieldNameTranslator::BD_DICT
Instance Attribute Summary collapse
-
#device_infos ⇒ Object
Returns the value of attribute device_infos.
-
#field_descriptions ⇒ Object
Returns the value of attribute field_descriptions.
-
#file_creator ⇒ Object
Returns the value of attribute file_creator.
-
#file_id ⇒ Object
Returns the value of attribute file_id.
Attributes inherited from FitDataRecord
Instance Method Summary collapse
-
#check ⇒ Object
Perform some basic logical checks on the object and all references sub objects.
-
#initialize(field_values = {}) ⇒ Metrics
constructor
Create a new Metrics object.
-
#new_fit_data_record(record_type, field_values = {}) ⇒ Object
Create a new FitDataRecord.
Methods inherited from FitDataRecord
#<=>, #==, #export, #get, #get_as, #get_unit_by_name, #set, #set_field_values, #write
Methods included from BDFieldNameTranslator
Methods included from Converters
#conversion_factor, #fit_time_to_time, #secsToDHMS, #secsToHM, #secsToHMS, #speedToPace, #time_to_fit_time
Constructor Details
#initialize(field_values = {}) ⇒ Metrics
Create a new Metrics object.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fit4ruby/Metrics.rb', line 35 def initialize(field_values = {}) super('metrics') @field_descriptions = [] @file_id = FileId.new @device_infos = [] @file_creator = nil @training_statuses = [] end |
Instance Attribute Details
#device_infos ⇒ Object
Returns the value of attribute device_infos.
30 31 32 |
# File 'lib/fit4ruby/Metrics.rb', line 30 def device_infos @device_infos end |
#field_descriptions ⇒ Object
Returns the value of attribute field_descriptions.
30 31 32 |
# File 'lib/fit4ruby/Metrics.rb', line 30 def field_descriptions @field_descriptions end |
#file_creator ⇒ Object
Returns the value of attribute file_creator.
30 31 32 |
# File 'lib/fit4ruby/Metrics.rb', line 30 def file_creator @file_creator end |
#file_id ⇒ Object
Returns the value of attribute file_id.
30 31 32 |
# File 'lib/fit4ruby/Metrics.rb', line 30 def file_id @file_id end |
Instance Method Details
#check ⇒ Object
Perform some basic logical checks on the object and all references sub objects. Any errors will be reported via the Log object.
48 49 |
# File 'lib/fit4ruby/Metrics.rb', line 48 def check end |
#new_fit_data_record(record_type, field_values = {}) ⇒ Object
Create a new FitDataRecord.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fit4ruby/Metrics.rb', line 57 def new_fit_data_record(record_type, field_values = {}) case record_type when 'file_id' @file_id = (record = FileId.new(field_values)) when 'file_creator' @software = (record = FileCreator.new(field_values)) when 'device_info' @device_infos << (record = DeviceInfo.new(field_values)) when 'training_status' @training_statuses << (record = TrainingStatus.new(field_values)) else record = nil end record end |