summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2025-01-12 20:47:25 +0800
committergit <[email protected]>2025-01-12 12:47:31 +0000
commit9f8defe8d2f406b0170a275b5d369957075ea059 (patch)
treef6cb201c9c24f727b5cc3c921925d5813d997248 /lib
parente2f1f7c56716db469bae28309c53b74f58023579 (diff)
[ruby/irb] Drop ColorPrinter's workaround for BasicObject
(https://github.com/ruby/irb/pull/1051) `pp` 0.6.0+ includes https://github.com/ruby/pp/pull/26 to handle BasicObject, so we can drop the workaround. https://github.com/ruby/irb/commit/08908d43c7
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/color_printer.rb5
-rw-r--r--lib/irb/irb.gemspec1
2 files changed, 1 insertions, 5 deletions
diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb
index 31644aa7f9..6cfaefd055 100644
--- a/lib/irb/color_printer.rb
+++ b/lib/irb/color_printer.rb
@@ -4,9 +4,6 @@ require_relative 'color'
module IRB
class ColorPrinter < ::PP
- METHOD_RESPOND_TO = Object.instance_method(:respond_to?)
- METHOD_INSPECT = Object.instance_method(:inspect)
-
class << self
def pp(obj, out = $>, width = screen_width)
q = ColorPrinter.new(out, width)
@@ -28,8 +25,6 @@ module IRB
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)
- text(METHOD_INSPECT.bind(obj).call)
else
super
end
diff --git a/lib/irb/irb.gemspec b/lib/irb/irb.gemspec
index 6bb257c8cf..9a93382b7a 100644
--- a/lib/irb/irb.gemspec
+++ b/lib/irb/irb.gemspec
@@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
spec.add_dependency "reline", ">= 0.4.2"
spec.add_dependency "rdoc", ">= 4.0.0"
+ spec.add_dependency "pp", ">= 0.6.0"
end