Class: Fit4Ruby::Event
- Inherits:
-
FitDataRecord
- Object
- FitDataRecord
- Fit4Ruby::Event
- Defined in:
- lib/fit4ruby/Event.rb
Constant Summary
Constants inherited from FitDataRecord
Constants included from BDFieldNameTranslator
BDFieldNameTranslator::BD_DICT
Instance Attribute Summary
Attributes inherited from FitDataRecord
Instance Method Summary collapse
-
#<=>(fdr) ⇒ Object
Ensure that FitDataRecords have a deterministic sequence.
-
#initialize(field_values = {}) ⇒ Event
constructor
A new instance of Event.
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 = {}) ⇒ Event
Returns a new instance of Event.
19 20 21 22 |
# File 'lib/fit4ruby/Event.rb', line 19 def initialize(field_values = {}) super('event') set_field_values(field_values) end |
Instance Method Details
#<=>(fdr) ⇒ Object
Ensure that FitDataRecords have a deterministic sequence. Events are sorted by event_type and then event.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fit4ruby/Event.rb', line 26 def <=>(fdr) @timestamp == fdr. ? @message.name == fdr..name ? @event_type == fdr.event_type ? @event <=> fdr.event : @event_type <=> fdr.event_type : RecordOrder.index(@message.name) <=> RecordOrder.index(fdr..name) : @timestamp <=> fdr. end |