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

ruby-changes:16513

From: yugui <ko1@a...>
Date: Thu, 1 Jul 2010 11:05:59 +0900 (JST)
Subject: [ruby-changes:16513] Ruby:r28504 (ruby_1_9_2): merges r28455 and r28460 from trunk into ruby_1_9_2.

yugui	2010-07-01 11:05:35 +0900 (Thu, 01 Jul 2010)

  New Revision: 28504

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

  Log:
    merges r28455 and r28460 from trunk into ruby_1_9_2.
    --
    * lib/rdoc/ri/driver.rb (RDoc::RI::Driver#formatter): should use bs
      format when stdout is piped.  [ruby-core:30734]
    --
    * test/rdoc/test_rdoc_ri_driver.rb (TestRDocRIDriver#test_formatter):
      fix a test accordingly to r28455.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/lib/rdoc/ri/driver.rb
    branches/ruby_1_9_2/test/rdoc/test_rdoc_ri_driver.rb

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28503)
+++ ruby_1_9_2/ChangeLog	(revision 28504)
@@ -1,3 +1,13 @@
+Mon Jun 28 22:14:22 2010  Yusuke Endoh  <mame@t...>
+
+	* test/rdoc/test_rdoc_ri_driver.rb (TestRDocRIDriver#test_formatter):
+	  fix a test accordingly to r28455.
+
+Mon Jun 28 05:32:51 2010  Yusuke Endoh  <mame@t...>
+
+	* lib/rdoc/ri/driver.rb (RDoc::RI::Driver#formatter): should use bs
+	  format when stdout is piped.  [ruby-core:30734]
+
 Mon Jun 28 03:12:03 2010  Yusuke Endoh  <mame@t...>
 
 	* bootstraptest/test_class.rb: add a test for [ruby-core:30843].
Index: ruby_1_9_2/lib/rdoc/ri/driver.rb
===================================================================
--- ruby_1_9_2/lib/rdoc/ri/driver.rb	(revision 28503)
+++ ruby_1_9_2/lib/rdoc/ri/driver.rb	(revision 28504)
@@ -546,7 +546,7 @@
 
   def display document
     page do |io|
-      text = document.accept formatter
+      text = document.accept formatter(io)
 
       io.write text
     end
@@ -795,10 +795,10 @@
   # Creates a new RDoc::Markup::Formatter.  If a formatter is given with -f,
   # use it.  If we're outputting to a pager, use bs, otherwise ansi.
 
-  def formatter
+  def formatter(io)
     if @formatter_klass then
       @formatter_klass.new
-    elsif paging? then
+    elsif paging? or !io.tty? then
       RDoc::Markup::ToBs.new
     else
       RDoc::Markup::ToAnsi.new
Index: ruby_1_9_2/test/rdoc/test_rdoc_ri_driver.rb
===================================================================
--- ruby_1_9_2/test/rdoc/test_rdoc_ri_driver.rb	(revision 28503)
+++ ruby_1_9_2/test/rdoc/test_rdoc_ri_driver.rb	(revision 28504)
@@ -498,15 +498,18 @@
   def test_formatter
     driver = RDoc::RI::Driver.new
 
-    assert_instance_of @RM::ToAnsi, driver.formatter
+    io = Object.new
+    def io.tty?; true; end
 
+    assert_instance_of @RM::ToAnsi, driver.formatter(io)
+
     driver.instance_variable_set :@paging, true
 
-    assert_instance_of @RM::ToBs, driver.formatter
+    assert_instance_of @RM::ToBs, driver.formatter(io)
 
     driver.instance_variable_set :@formatter_klass, @RM::ToHtml
 
-    assert_instance_of @RM::ToHtml, driver.formatter
+    assert_instance_of @RM::ToHtml, driver.formatter(io)
   end
 
   def test_method_type

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

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