Skip to content
Browse files

* lib/optparse.rb (OptionParser#to_a): split for each lines.

  [ruby-dev:45568][Bug #6348]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent a06cddb commit 3c2f707f1688a23602b9fdbc42db1970658b9945 @nobu nobu committed Apr 24, 2012
Showing with 7 additions and 2 deletions.
  1. +5 −0 ChangeLog
  2. +1 −1 lib/optparse.rb
  3. +1 −1 test/optparse/test_summary.rb
View
5 ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 25 05:46:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#to_a): split for each lines.
+ [ruby-dev:45568][Bug #6348]
+
Tue Apr 24 21:57:53 2012 Tanaka Akira <akr@fsij.org>
* ext/socket/raddrinfo.c (init_unix_addrinfo): show actual path length
View
2 lib/optparse.rb
@@ -1071,7 +1071,7 @@ def help; summarize("#{banner}".sub(/\n?\z/, "\n")) end
#
# Returns option summary list.
#
- def to_a; summarize("#{banner}".split) end
+ def to_a; summarize("#{banner}".split(/^/)) end
#
# Checks if an argument is given twice, in which case an ArgumentError is
View
2 test/optparse/test_summary.rb
@@ -33,6 +33,6 @@ def test_banner_from_progname
def test_summary
o = OptionParser.new("foo\nbar")
assert_equal("foo\nbar\n", o.to_s)
- assert_equal(["foo", "bar"], o.to_a)
+ assert_equal(["foo\n", "bar"], o.to_a)
end
end

0 comments on commit 3c2f707

Please sign in to comment.
Something went wrong with that request. Please try again.