lib/ecu/interfaces/dcm/property_parser.rb in automotive-ecu-0.1.2 vs lib/ecu/interfaces/dcm/property_parser.rb in automotive-ecu-0.1.3
- old
+ new
@@ -29,14 +29,20 @@
def self.string_value(str)
str.delete_surrounding('"')
end
def self.numeric_array(str)
- str.split.map { Float(_1) }
+ str.split.map { numeric_value(_1) }
end
def self.string_array(str)
str.scan(/"([^"]*)"/).flatten
+ end
+
+ def self.numeric_value(str)
+ return str.to_f if str.match?(/^\d+\.$/)
+
+ Float(str)
end
end
end