lib/fit_parser/file/data.rb in fit_parser-1.0.7 vs lib/fit_parser/file/data.rb in fit_parser-1.0.8

- old
+ new

@@ -60,10 +60,11 @@ class_eval code, __FILE__, __LINE__ + 1 end definition.dev_fields_arr.each do |field| + next unless dev_definitions developer_data = dev_definitions[field[:developer_data_index].to_s] next unless developer_data data = developer_data[field[:field_number].to_s] field.base_type_number = data[:raw_field_2] field.name = data[:raw_field_3].downcase.gsub(' ', '_').gsub('.', '').gsub('%', '') @@ -80,11 +81,11 @@ code << ", :read_length => #{field.field_size}, :trim_padding => true" end code << "\n" end - code << "def #{field.name.gsub('/', '_').gsub('+', '').gsub('%', '')}\n" + code << "define_method \"#{field.name}\" do\n" if field.scale && field.scale != 1 scale = field.scale if scale.is_a?(Integer) code << "scale = #{scale.inspect}.0\n" @@ -100,10 +101,10 @@ else code << "dyn = nil\n" end code << <<-RUBY - get_value #{field.raw_name.gsub('/', '_').gsub('%', '')}.snapshot, '#{field.real_type}', scale, dyn + get_value #{field.raw_name}.snapshot, '#{field.real_type}', scale, dyn end RUBY class_eval code, __FILE__, __LINE__ + 1 end