lib/ecu/interfaces/dcm/property_parser.rb in automotive-ecu-0.1.4 vs lib/ecu/interfaces/dcm/property_parser.rb in automotive-ecu-0.1.5
- old
+ new
@@ -37,12 +37,14 @@
def self.string_array(str)
str.scan(/"([^"]*)"/).flatten
end
def self.numeric_value(str)
- return str.to_f if str.match?(/^\d+\.$/)
-
- Float(str)
+ case str
+ in /^\d+$/ then str.to_i
+ in /^\d+\.$/ then str.to_f
+ else Float(str)
+ end
end
end
end