diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-21 21:02:13 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-21 21:02:13 +0000 |
| commit | 4fbc945d5a4d4cf746c690cef1e533dd90ee5b7b (patch) | |
| tree | e78d5d2f0a5055e14b0478b3058400040d6dcb40 | |
| parent | cfea253c0ffad7fccf6f9211310f9012428e4bb4 (diff) | |
* lib/optparse.rb (OptionParser::List::summarize): use each_line if
defined rather than each. [ruby-Patches-14096]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/optparse.rb | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Sat Sep 22 06:02:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/optparse.rb (OptionParser::List::summarize): use each_line if + defined rather than each. [ruby-Patches-14096] + Sat Sep 22 05:19:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> * ext/stringio/stringio.c (strio_init): separate from strio_initialize diff --git a/lib/optparse.rb b/lib/optparse.rb index 0c4b484e02..4cf2230448 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -633,8 +633,10 @@ class OptionParser list.each do |opt| if opt.respond_to?(:summarize) # perhaps OptionParser::Switch opt.summarize(*args, &block) - elsif !opt or opt.empty? + elsif !opt yield("") + elsif opt.respond_to?(:each_line) + opt.each_line(&block) else opt.each(&block) end |
