summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-28 06:12:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-28 06:12:58 +0000
commit2d67a3f4b141837aa94f995af0f514bf23401b63 (patch)
treee746b64036c7cecbda2b8488819b56c21c367226 /lib
parentb7fccecf1c286ae9baff67fa84d1c58800b87506 (diff)
Get rid of block-less Proc.new
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/optparse.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 56628079fd..d3b504a413 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -534,8 +534,9 @@ class OptionParser
def initialize(pattern = nil, conv = nil,
short = nil, long = nil, arg = nil,
- desc = ([] if short or long), block = Proc.new)
+ desc = ([] if short or long), block = nil, &_block)
raise if Array === pattern
+ block ||= _block
@pattern, @conv, @short, @long, @arg, @desc, @block =
pattern, conv, short, long, arg, desc, block
end