Closed natsu1375 closed 1 day ago
This is not an issue of IRB but a specification of PP.
p Person.new
#=> Person_inspect
pp Person.new
#=> #<struct Person>
Same for array
arr = [].tap{def _1.inspect = "(empty)"}
p arr
#=> (empty)
pp arr
#=> []
You need to define pretty_print and pretty_print_cycle to customize the output of pp.
Expect
Person.new
should be evaluated asPerson_inspect
in IRB console, since we define ainspect
method for it. But got#<struct Person>
.An instance of a plain class
PersonX
works as expected.