Skip to content

Commit 9f8defe

Browse files
st0012matzbot
authored andcommitted
[ruby/irb] Drop ColorPrinter's workaround for BasicObject
(ruby/irb#1051) `pp` 0.6.0+ includes ruby/pp#26 to handle BasicObject, so we can drop the workaround. ruby/irb@08908d43c7
1 parent e2f1f7c commit 9f8defe

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

lib/irb/color_printer.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
module IRB
66
class ColorPrinter < ::PP
7-
METHOD_RESPOND_TO = Object.instance_method(:respond_to?)
8-
METHOD_INSPECT = Object.instance_method(:inspect)
9-
107
class << self
118
def pp(obj, out = $>, width = screen_width)
129
q = ColorPrinter.new(out, width)
@@ -28,8 +25,6 @@ def pp(obj)
2825
if String === obj
2926
# Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n"
3027
text(obj.inspect)
31-
elsif !METHOD_RESPOND_TO.bind(obj).call(:inspect)
32-
text(METHOD_INSPECT.bind(obj).call)
3328
else
3429
super
3530
end

lib/irb/irb.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
4242

4343
spec.add_dependency "reline", ">= 0.4.2"
4444
spec.add_dependency "rdoc", ">= 4.0.0"
45+
spec.add_dependency "pp", ">= 0.6.0"
4546
end

0 commit comments

Comments
 (0)