The documentation describes these arguments being hashes, and the method
is called with hashes, so a hash default makes more sense.
The method would fail previously if called without arguments and @short
or @long contained a non-integer value.
Fixes [Bug #10928]
* lib/optparse.rb (OptionParser::Switch#initialize): get rid of
`Proc.new` without a block, which may be deprecated in the future.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb: [DOC] simplify shell prompt in examples;
other minor improvements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb: add documentation for "into" option of #parse
and family, which stores options to a Hash.
[ruby-core:87004] [Misc #14753]
From: pocke (Masataka Kuwabara) <kuwabara@pocke.me>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (OptionParser#summarize): use literal newline to
join option summaries as IO#puts does, not the special gloval
variable $/.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (OptionParser#summarize): use literal newline to
join option summaries as IO#puts does, not the special gloval
variable $/.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (candidate): short options are case-sensitive by
the default, should not match case-different options..
https://github.com/mernen/completion-ruby/pull/9#issuecomment-317287946
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb: try Float() and Integer() instead of eval,
which does too much things.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* lib/optparse.rb: [DOC] nodoc OptParse, introduced with r46126,
to avoid leaking of its documentation (OptionParser's docs) into
the class documentation of Object. [ruby-core:79909] [Bug #13281]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (OptionParser::Completion.candidate): get rid of
nil as key names. [ruby-core:75773] [Bug #12438]
* lib/optparse.rb (OptionParser#make_switch): char class option
cannot be NoArgument, default to RequiredArgument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (OptionParser#parse_in_order): get rid of making
duplicate strings; $1 and others make a new string each times.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb: [DOC] fix example code. base on the code by
Semyon Gaivoronskiy in [ruby-core:75224]. [Bug #12323]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb: get rid of confusing ruby-mode.el of Emacs 24,
- if-end expression inside an expression
- a comma just followed by a bar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (getopts): print default values and descriptions
in the help message. [fix GH-676]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optparse.rb (OptionParser::Switch#compsys): regexp literal
should be lhs of =~.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hexadecimal numbers per the documentation. [ruby-trunk - Bug #8865]
DecimalInteger, OctalInteger, DecimalNumeric now validate their input
before converting to a number. [ruby-trunk - Bug #8865]
* test/optparse/test_acceptable.rb: Tests for the above, tests for all
numeric acceptables for existing behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e