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

ruby-changes:72804

From: tompng <ko1@a...>
Date: Thu, 4 Aug 2022 08:37:19 +0900 (JST)
Subject: [ruby-changes:72804] b54f26b704 (master): [ruby/irb] shortcut colorize_code to speedup pretty_print

https://git.ruby-lang.org/ruby.git/commit/?id=b54f26b704

From b54f26b7048fc8dd103e7da5cf8f8dd73feb10d0 Mon Sep 17 00:00:00 2001
From: tompng <tomoyapenguin@g...>
Date: Tue, 2 Aug 2022 04:10:45 +0900
Subject: [ruby/irb] shortcut colorize_code to speedup pretty_print

https://github.com/ruby/irb/commit/8a074a6904
---
 lib/irb/color_printer.rb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb
index 78f0b51520..1127bcecb4 100644
--- a/lib/irb/color_printer.rb
+++ b/lib/irb/color_printer.rb
@@ -37,6 +37,9 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/color_printer.rb#L37
       width ||= str.length
 
       case str
+      when ''
+      when ',', '=>', '[', ']', '{', '}', '..', '...', /\A@\w+\z/
+        super(str, width)
       when /\A#</, '=', '>'
         super(Color.colorize(str, [:GREEN]), width)
       else
-- 
cgit v1.2.1


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

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