1. `require` can mislead Ruby to load system irb's files and cause
constant redefined warnings as other code loads the same module/class
from lib folder.
2. Most files already use `require_relative`.
https://github.com/ruby/irb/commit/848d339f2e
http://rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20210119T070008Z.log.html.gz
is caused by:
/export/home/chkbuild/chkbuild-gcc/tmp/build/20210119T150010Z/ruby/lib/reline/ansi.rb:157:in `winsize': Invalid argument - <STDIN> (Errno::EINVAL)
from /export/home/chkbuild/chkbuild-gcc/tmp/build/20210119T150010Z/ruby/lib/reline/ansi.rb:157:in `get_screen_size'
from /export/home/chkbuild/chkbuild-gcc/tmp/build/20210119T150010Z/ruby/lib/reline.rb:168:in `get_screen_size'
from /export/home/chkbuild/chkbuild-gcc/tmp/build/20210119T150010Z/ruby/lib/forwardable.rb:238:in `get_screen_size'
from /export/home/chkbuild/chkbuild-gcc/tmp/build/20210119T150010Z/ruby/lib/irb/color_printer.rb:7:in `pp'
from -e:1:in `<main>'
https://github.com/ruby/irb/commit/1719514598
The incompatible interface is not helpful, again if you want to use it
as a standalone library, falling it back to PP.
Original PP.pp also ends with `out << "\n"`.
https://github.com/ruby/irb/commit/4c74c7d84c
This is useful if you want to use IRB::ColorPrinter as a library like:
```
begin
require 'irb/color_printer'
IRB::ColorPrinter.pp(obj)
rescue LoadError
pp(obj)
end
```
https://github.com/ruby/irb/commit/f8461691c7
If a nested object is passed to #pp, it may be sometimes passed to the #text
method as an object without being stringified.
This is fixed on the Ruby main repository;
433a3be86a
but it was a bug of Ripper so still needs this workaround for using irb
as a gem on Ruby 3.0.0 or earlier.
Co-authored-by: k0kubun <takashikkbn@gmail.com>
https://github.com/ruby/irb/commit/8d13df22ee