module Fit::File::Definitions
Public Class Methods
add_field(global_msg_num, field_def_num, name, options = {})
click to toggle source
# File lib/fit/file/definitions.rb, line 10 def add_field(global_msg_num, field_def_num, name, options = {}) if @@fields[global_msg_num].has_key? field_def_num raise "bad definition of dynamic field (#{name}) without :ref_field_name or :ref_field_values" unless options.has_key?(:ref_field_name) && options.has_key?(:ref_field_values) @@dyn_fields[global_msg_num][field_def_num] ||= {} @@dyn_fields[global_msg_num][field_def_num][name.to_sym] = options # let's put the ref_field_values with the raw_value instead of the real value type = Types.get_type_definition(options[:ref_field_name].to_sym) if options[:ref_field_name] # basic types are not found and returns nil (also some rspec dummy tests) if type type = type[:values].invert @@dyn_fields[global_msg_num][field_def_num][name.to_sym][:ref_field_values] = options[:ref_field_values].map { |elt| type[elt.to_s] } end else @@fields[global_msg_num][field_def_num] = options.merge(:name => name) end end
add_name(global_msg_num, name)
click to toggle source
# File lib/fit/file/definitions.rb, line 35 def add_name(global_msg_num, name) @@names[global_msg_num] = name end
get_dynamic_fields(global_msg_num, field_def_num)
click to toggle source
# File lib/fit/file/definitions.rb, line 31 def get_dynamic_fields(global_msg_num, field_def_num) @@dyn_fields[global_msg_num][field_def_num] end
get_field(global_msg_num, field_def_num)
click to toggle source
# File lib/fit/file/definitions.rb, line 27 def get_field(global_msg_num, field_def_num) @@fields[global_msg_num][field_def_num] end
get_name(global_msg_num)
click to toggle source
# File lib/fit/file/definitions.rb, line 39 def get_name(global_msg_num) @@names[global_msg_num] end