From 45880b8e7d7934c008b643bb9b99c31b97c39472 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 18 Sep 2008 11:38:24 +0000 Subject: [PATCH] * lib/optparse.rb (OptionParser::ParseError#set_backtrace): omits OptionParser internal backtraces unless debug flag is set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/optparse.rb | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7e0d62565a..0cfd894884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Sep 18 20:37:59 2008 Nobuyoshi Nakada + + * lib/optparse.rb (OptionParser::ParseError#set_backtrace): omits + OptionParser internal backtraces unless debug flag is set. + Thu Sep 18 20:02:48 2008 Yusuke Endoh * lib/uri/common.rb (unescape): skip '%' to make String#hex work diff --git a/lib/optparse.rb b/lib/optparse.rb index 86681235a0..aef3c0d486 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1605,6 +1605,13 @@ class OptionParser argv end + def set_backtrace(array) + unless $DEBUG + array.delete_if(&%r"\A#{Regexp.quote(__FILE__)}:"o.method(:=~)) + end + super(array) + end + def set_option(opt, eq) if eq @args[0] = opt