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

ruby-changes:10383

From: nobu <ko1@a...>
Date: Sun, 1 Feb 2009 16:14:52 +0900 (JST)
Subject: [ruby-changes:10383] Ruby:r21927 (ruby_1_8): * lib/optparse.rb (Switch#summarize): strips an equal sign from

nobu	2009-02-01 16:14:38 +0900 (Sun, 01 Feb 2009)

  New Revision: 21927

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

  Log:
    * lib/optparse.rb (Switch#summarize): strips an equal sign from
      short option, and fills right sides in shorter lines.
      [ruby-talk:326414]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/optparse.rb
    branches/ruby_1_8/version.h

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 21926)
+++ ruby_1_8/ChangeLog	(revision 21927)
@@ -1,3 +1,9 @@
+Sun Feb  1 16:14:37 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/optparse.rb (Switch#summarize): strips an equal sign from
+	  short option, and fills right sides in shorter lines.
+	  [ruby-talk:326414]
+
 Sat Jan 31 16:04:38 2009  Tanaka Akira  <akr@f...>
 
 	* io.c (io_getpartial): fflush after read for updating pos in FILE.
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 21926)
+++ ruby_1_8/version.h	(revision 21927)
@@ -1,15 +1,15 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2009-01-31"
+#define RUBY_RELEASE_DATE "2009-02-01"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20090131
+#define RUBY_RELEASE_CODE 20090201
 #define RUBY_PATCHLEVEL 5000
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2009
-#define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 31
+#define RUBY_RELEASE_MONTH 2
+#define RUBY_RELEASE_DAY 1
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/lib/optparse.rb
===================================================================
--- ruby_1_8/lib/optparse.rb	(revision 21926)
+++ ruby_1_8/lib/optparse.rb	(revision 21927)
@@ -384,10 +384,16 @@
         left[-1] << if left[-1].empty? then ' ' * 4 else ', ' end << s
       end
 
-      left[0] << arg if arg
+      if arg
+        left[0] << (left[1] ? arg.sub(/\A(\[?)=/, '\1') + ',' : arg)
+      end
       mlen = left.collect {|s| s.length}.max.to_i
       while mlen > width and l = left.shift
         mlen = left.collect {|s| s.length}.max.to_i if l.length == mlen
+        if l.length < width and (r = right[0]) and !r.empty?
+          l = l.to_s.ljust(width) + ' ' + r
+          right.shift
+        end
         yield(indent + l)
       end
 

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

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