Hey there!
I come across this weird bug(?) when I was trying to inspect an object in irb. Since irb uses pp to print the objects I'm opening this issue here.
In my case I have a class that inherits from SimpleDelegator:
require"delegate"classParentdefinspect"<parent>"endendclassChild < SimpleDelegatordefinspect"<child>"endend
In irb I noticed it because the objects are being shown using inspect:
irb(main):001> Parent.new.inspect# => "<parent>"irb(main):002> Parent.new# => <parent>irb(main):003> Child.new(Parent.new).inspect# => "<child>"irb(main):004> Child.new(Parent.new)# => <parent>
Personally, I would have expected the last one to also show <child>. Now after digging into this a bit more (thanks @st0012), it seems like you can also reproduce this in pp directly using:
require"delegate"require"pp"classParentdefinspect"<parent>"endendclassChild < SimpleDelegatordefinspect"<child>"endendparent=Parent.newchild=Child.new(parent)ppchild#=> "<parent>"
Hey there!
I come across this weird bug(?) when I was trying to inspect an object in
irb. Since irb usesppto print the objects I'm opening this issue here.In my case I have a class that inherits from
SimpleDelegator:In
irbI noticed it because the objects are being shown usinginspect:Personally, I would have expected the last one to also show
<child>. Now after digging into this a bit more (thanks @st0012), it seems like you can also reproduce this inppdirectly using: