lib/fit_parser/file/data.rb in fit_parser-1.0.2 vs lib/fit_parser/file/data.rb in fit_parser-1.0.3

- old
+ new

@@ -71,18 +71,18 @@ # 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}" + code << "#{field.type} :#{field.raw_name.gsub('/', '_')}" if field.type == 'string' code << ", :read_length => #{field.field_size}, :trim_padding => true" end code << "\n" end - code << "def #{field.name}\n" + code << "def #{field.name.gsub('/', '_')}\n" if field.scale && field.scale != 1 scale = field.scale if scale.is_a?(Integer) code << "scale = #{scale.inspect}.0\n" @@ -96,11 +96,12 @@ if field.dyn_data code << "dyn = #{field.dyn_data}\n" else code << "dyn = nil\n" end + code << <<-RUBY - get_value #{field.raw_name}.snapshot, '#{field.real_type}', scale, dyn + get_value #{field.raw_name.gsub('/', '_')}.snapshot, '#{field.real_type}', scale, dyn end RUBY class_eval code, __FILE__, __LINE__ + 1 end