[前][次][番号順一覧][スレッド一覧]

ruby-changes:23416

From: nobu <ko1@a...>
Date: Wed, 25 Apr 2012 05:46:26 +0900 (JST)
Subject: [ruby-changes:23416] nobu:r35467 (trunk): * lib/optparse.rb (OptionParser#to_a): split for each lines.

nobu	2012-04-25 05:46:14 +0900 (Wed, 25 Apr 2012)

  New Revision: 35467

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35467

  Log:
    * lib/optparse.rb (OptionParser#to_a): split for each lines.
      [ruby-dev:45568][Bug #6348]

  Modified files:
    trunk/ChangeLog
    trunk/lib/optparse.rb
    trunk/test/optparse/test_summary.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35466)
+++ ChangeLog	(revision 35467)
@@ -1,3 +1,8 @@
+Wed Apr 25 05:46:12 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@f...>
 
 	* ext/socket/raddrinfo.c (init_unix_addrinfo): show actual path length
Index: lib/optparse.rb
===================================================================
--- lib/optparse.rb	(revision 35466)
+++ lib/optparse.rb	(revision 35467)
@@ -1071,7 +1071,7 @@
   #
   # 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
Index: test/optparse/test_summary.rb
===================================================================
--- test/optparse/test_summary.rb	(revision 35466)
+++ test/optparse/test_summary.rb	(revision 35467)
@@ -33,6 +33,6 @@
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]