Support BasicObject
When investigating https://github.com/ruby/irb/issues/540, I found that pp doesn't support BasicObject. Consider we start supporting it in tools like irb or debug, I think it may be good for pp to start supporting it too.
Using bind_call on BasicObject works well with CRuby. But with JRuby it raises
NoMethodError: undefined method `respond_to_missing?' for #<BasicObject:0x2da5fdc>
It's probably because the difference in implementation. But I couldn't trace it deeper.
@headius 👋 this PR rebinds methods like Kernel#respond_to? to support BasicObject, which is an approach used in both ruby/debug and IRB too. It works for TruffleRuby and CRuby but causes error in JRuby:
Error: test_basic_object(PPTestModule::PPTest): NoMethodError: undefined method `respond_to_missing?' for #<BasicObject:0x56c6d515>
org/jruby/RubyKernel.java:[21](https://github.com/ruby/pp/actions/runs/4803138033/jobs/8547336749?pr=12#step:5:22)82:in `respond_to?'
org/jruby/RubyUnboundMethod.java:169:in `bind_call'
/home/runner/work/pp/pp/lib/pp.rb:204:in `pp'
/home/runner/work/pp/pp/lib/pp.rb:96:in `block in pp'
/home/runner/work/pp/pp/lib/pp.rb:160:in `guard_inspect_key'
/home/runner/work/pp/pp/lib/pp.rb:96:in `pp'
/home/runner/work/pp/pp/test/test_pp.rb:[25](https://github.com/ruby/pp/actions/runs/4803138033/jobs/8547336749?pr=12#step:5:26):in `test_basic_object'
Is this something JRuby can match CRuby's behaviour on? Otherwise, even if this PR is not accepted, the same error would still occur in IRB.