summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/optparse.rb2
-rw-r--r--test/optparse/test_summary.rb6
3 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 731831f..f738539 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-Tue Apr 24 14:54:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 24 15:51:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#to_a): should split by end-of-line
+ [ruby-dev:45568][Bug #6348]
* lib/optparse.rb (OptionParser#to_a): String#to_a is no longer
defined. [ruby-dev:45568][Bug #6348]
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 75c6b76..2306606 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1071,7 +1071,7 @@ XXX
#
# Returns option summary list.
#
- def to_a; summarize([*banner]) end
+ def to_a; summarize("#{banner}".split(/$/)) end
#
# Checks if an argument is given twice, in which case an ArgumentError is
diff --git a/test/optparse/test_summary.rb b/test/optparse/test_summary.rb
index bda3b49..2fad5f0 100644
--- a/test/optparse/test_summary.rb
+++ b/test/optparse/test_summary.rb
@@ -31,8 +31,8 @@ class TestOptionParser::SummaryTest < TestOptionParser
end
def test_summary
- o = OptionParser.new("foo bar")
- assert_equal("foo bar\n", o.to_s)
- assert_equal(["foo bar"], o.to_a)
+ o = OptionParser.new("foo\nbar")
+ assert_equal("foo\nbar\n", o.to_s)
+ assert_equal(["foo", "bar"], o.to_a)
end
end