lib/fit_parser/file/data.rb in fit_parser-1.0.5 vs lib/fit_parser/file/data.rb in fit_parser-1.0.6
- old
+ new
@@ -62,27 +62,27 @@
end
definition.dev_fields_arr.each do |field|
data = dev_definitions[field[:developer_data_index].to_s][field[:field_number].to_s]
field.base_type_number = data[:raw_field_2]
- field.name = data[:raw_field_3].downcase.gsub(' ', '_').gsub('.', '')
+ field.name = data[:raw_field_3].downcase.gsub(' ', '_').gsub('.', '').gsub('%', '')
field.scale = data[:raw_field_6] && data[:raw_field_6] != 255 ? data[:raw_field_6] : nil
code = ''
# in case the field size is a multiple of the field length, we must build an array
if field.type != 'string' && field.field_size > field.length
code << "array :#{field.raw_name}, :type => :#{field.type}, :initial_length => #{field.field_size/field.length}\n"
else
# string are not null terminated when they have exactly the lenght of the field
- code << "#{field.type} :#{field.raw_name.gsub('/', '_').gsub('+', '')}"
+ code << "#{field.type} :#{field.raw_name.gsub('/', '_').gsub('+', '').gsub('%', '')}"
if field.type == 'string'
code << ", :read_length => #{field.field_size}, :trim_padding => true"
end
code << "\n"
end
- code << "def #{field.name.gsub('/', '_').gsub('+', '')}\n"
+ code << "def #{field.name.gsub('/', '_').gsub('+', '').gsub('%', '')}\n"
if field.scale && field.scale != 1
scale = field.scale
if scale.is_a?(Integer)
code << "scale = #{scale.inspect}.0\n"
@@ -98,10 +98,10 @@
else
code << "dyn = nil\n"
end
code << <<-RUBY
- get_value #{field.raw_name.gsub('/', '_')}.snapshot, '#{field.real_type}', scale, dyn
+ get_value #{field.raw_name.gsub('/', '_').gsub('%', '')}.snapshot, '#{field.real_type}', scale, dyn
end
RUBY
class_eval code, __FILE__, __LINE__ + 1
end