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

ruby-changes:47747

From: hsbt <ko1@a...>
Date: Wed, 13 Sep 2017 18:06:12 +0900 (JST)
Subject: [ruby-changes:47747] hsbt:r59864 (trunk): Fixup r59856. Added workaround for JRuby.

hsbt	2017-09-13 18:06:05 +0900 (Wed, 13 Sep 2017)

  New Revision: 59864

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59864

  Log:
    Fixup r59856. Added workaround for JRuby.

  Modified files:
    trunk/lib/rdoc/stats/normal.rb
Index: lib/rdoc/stats/normal.rb
===================================================================
--- lib/rdoc/stats/normal.rb	(revision 59863)
+++ lib/rdoc/stats/normal.rb	(revision 59864)
@@ -1,5 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/stats/normal.rb#L1
 # frozen_string_literal: false
-require 'io/console/size'
+begin
+  require 'io/console/size'
+rescue LoadError
+  # for JRuby
+  require 'io/console'
+end
 
 ##
 # Stats printer that prints just the files being documented with a progress
@@ -23,7 +28,8 @@ class RDoc::Stats::Normal < RDoc::Stats: https://github.com/ruby/ruby/blob/trunk/lib/rdoc/stats/normal.rb#L28
 
     # Print a progress bar, but make sure it fits on a single line. Filename
     # will be truncated if necessary.
-    terminal_width = IO.console_size[1].to_i.nonzero? || 80
+    size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize
+    terminal_width = size[1].to_i.nonzero? || 80
     max_filename_size = terminal_width - progress_bar.size
 
     if filename.size > max_filename_size then

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

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