From 309ff928f5470697d6def63c5dd45255d2a09e1d Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Tue, 14 Mar 2023 02:11:53 +0800 Subject: [ruby/irb] Replace METHOD_IS_A with === (https://github.com/ruby/irb/pull/542) https://github.com/ruby/irb/commit/edd6c30e16 --- lib/irb/color_printer.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/irb/color_printer.rb') diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb index a4eeb140cd..31644aa7f9 100644 --- a/lib/irb/color_printer.rb +++ b/lib/irb/color_printer.rb @@ -4,7 +4,6 @@ require_relative 'color' module IRB class ColorPrinter < ::PP - METHOD_IS_A = Object.instance_method(:is_a?) METHOD_RESPOND_TO = Object.instance_method(:respond_to?) METHOD_INSPECT = Object.instance_method(:inspect) @@ -26,7 +25,7 @@ module IRB end def pp(obj) - if METHOD_IS_A.bind(obj).call(String) + if String === obj # Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n" text(obj.inspect) elsif !METHOD_RESPOND_TO.bind(obj).call(:inspect) -- cgit v1.2.3