# File ruby-3.1.2/lib/irb/color_printer.rb, line 24 def pp(obj) if obj.is_a?(String) # Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n" text(obj.inspect) else super end end
# File ruby-3.1.2/lib/irb/color_printer.rb, line 33 def text(str, width = nil) unless str.is_a?(String) str = str.inspect end width ||= str.length case str when /\A#</, '=', '>' super(Color.colorize(str, [:GREEN]), width) else super(Color.colorize_code(str, ignore_error: true), width) end end