Preserve custom inspect on Delegator wrappers - #100
Open
OskarEichler wants to merge 2 commits into
Open
Conversation
Source-only backport of 3011356; tests excluded under consumer task policy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency: This is a focused follow-up to open PR #60. The branch contains a release-compatible adaptation of #60 followed by one reviewable fix commit; #60 should land first or this branch should be rebased after it lands.
Problem: PR #60 restores a Delegator wrapper's custom pretty_print, but issue #39 remains for wrappers that customize only inspect: PP replaces the wrapper presentation with the delegated target's output.
Fix: Apply the documented priority wrapper pretty_print > wrapper inspect > target/generic, while preserving target fallback, cycle handling, BasicObject support, and exception propagation. The implementation avoids materializing singleton classes for ordinary wrappers.
Regression coverage: Adds upstream cases for class-level and singleton inspect, custom pretty_print priority, BasicObject targets, inspect failures, and both delegate/pp load orders. The combined completion branch passes 42 tests / 64 assertions on Ruby 4.0.6 and 39 / 56 on Ruby 3.2, plus 510 focused model checks on each Ruby. No separate issue was opened; this addresses existing #39.