aboutsummaryrefslogtreecommitdiffstats
path: root/lib/optparse.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-06 11:49:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-06 11:49:03 +0000
commit8ddf0263bb0a8536e40eb088d8620f13f28c4c52 (patch)
treec7c4b520d2901ee3ae854b2662a0944a69faa887 /lib/optparse.rb
parent06a3a10acf1951429e3e2e8d18fd1a283fa5b132 (diff)
downloadruby-8ddf0263bb0a8536e40eb088d8620f13f28c4c52.tar.gz
Fix DecimalInteger converting to octal bug
Previously if the input started with a '0' then it will be converted as octal even though it has been specified as a decimal. This commit forces the number to be interpreted as a decimal. [ruby-core:81927] [Bug #13722] [Fix GH-1665] Author: william <william.mccumstie@outlook.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r--lib/optparse.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb
index d887e2f98d..b4c44545bb 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1865,7 +1865,7 @@ XXX
DecimalInteger = /\A[-+]?#{decimal}\z/io
accept(DecimalInteger, DecimalInteger) {|s,|
begin
- Integer(s)
+ Integer(s, 10)
rescue ArgumentError
raise OptionParser::InvalidArgument, s
end if s