[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
This commit is contained in:
parent
e2f1f7c567
commit
9f8defe8d2
@ -4,9 +4,6 @@ require_relative 'color'
|
|||||||
|
|
||||||
module IRB
|
module IRB
|
||||||
class ColorPrinter < ::PP
|
class ColorPrinter < ::PP
|
||||||
METHOD_RESPOND_TO = Object.instance_method(:respond_to?)
|
|
||||||
METHOD_INSPECT = Object.instance_method(:inspect)
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def pp(obj, out = $>, width = screen_width)
|
def pp(obj, out = $>, width = screen_width)
|
||||||
q = ColorPrinter.new(out, width)
|
q = ColorPrinter.new(out, width)
|
||||||
@ -28,8 +25,6 @@ module IRB
|
|||||||
if String === obj
|
if String === obj
|
||||||
# Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n"
|
# Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n"
|
||||||
text(obj.inspect)
|
text(obj.inspect)
|
||||||
elsif !METHOD_RESPOND_TO.bind(obj).call(:inspect)
|
|
||||||
text(METHOD_INSPECT.bind(obj).call)
|
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
|
|||||||
|
|
||||||
spec.add_dependency "reline", ">= 0.4.2"
|
spec.add_dependency "reline", ">= 0.4.2"
|
||||||
spec.add_dependency "rdoc", ">= 4.0.0"
|
spec.add_dependency "rdoc", ">= 4.0.0"
|
||||||
|
spec.add_dependency "pp", ">= 0.6.0"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user