diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-04 16:24:58 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-04 16:24:58 +0000 |
commit | b7c66e31de87dc6f4b1b8666f44b2487b1c0b3b8 (patch) | |
tree | ffc49114e08c293b602ea0844a25b90a2db23fa9 /ext | |
parent | 92a05ea2cf375e415ddd420243d0e38801708f8a (diff) | |
download | ruby-b7c66e31de87dc6f4b1b8666f44b2487b1c0b3b8.tar.gz |
* ext/psych/lib/psych/scalar_scanner.rb: use normal begin / rescue
since postfix rescue cannot receive the exception class. Thanks
nagachika!
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/lib/psych/scalar_scanner.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb index 3e8acbb21c..e390cbb16a 100644 --- a/ext/psych/lib/psych/scalar_scanner.rb +++ b/ext/psych/lib/psych/scalar_scanner.rb @@ -74,13 +74,19 @@ module Psych end i when FLOAT - return Float(string.gsub(/[,_]/, '')) rescue ArgumentError + begin + return Float(string.gsub(/[,_]/, '')) + rescue ArgumentError + end @string_cache[string] = true string else if string.count('.') < 2 - return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError + begin + return Integer(string.gsub(/[,_]/, '')) + rescue ArgumentError + end end @string_cache[string] = true |