Skip to content

Commit edd6c30

Browse files
authored
Replace METHOD_IS_A with === (#542)
1 parent 1dc2a40 commit edd6c30

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/irb/color_printer.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
module IRB
66
class ColorPrinter < ::PP
7-
METHOD_IS_A = Object.instance_method(:is_a?)
87
METHOD_RESPOND_TO = Object.instance_method(:respond_to?)
98
METHOD_INSPECT = Object.instance_method(:inspect)
109

@@ -26,7 +25,7 @@ def screen_width
2625
end
2726

2827
def pp(obj)
29-
if METHOD_IS_A.bind(obj).call(String)
28+
if String === obj
3029
# Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n"
3130
text(obj.inspect)
3231
elsif !METHOD_RESPOND_TO.bind(obj).call(:inspect)

0 commit comments

Comments
 (0)