summaryrefslogtreecommitdiff
path: root/ext/psych/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/lib')
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index 29d66ee4cc..b92d3c075e 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -68,8 +68,11 @@ module Psych
end
i
else
- return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
- return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
+ if string.count('.') < 2
+ return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
+ return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
+ end
+
@string_cache[string] = true
string
end