module PP::PPMethods
@api public @since 0.24.0
Public Instance Methods
pp(obj)
click to toggle source
:nocov:
# File lib/qonfig/plugins/pretty_print/ruby_2_7_basic_object_pp_patch.rb, line 12 def pp(obj) # If obj is a Delegator then use the object being delegated to for cycle # detection # NOTE: --- PATCH --- if defined?(::Delegator) and ( begin (class << obj; self; end) <= ::Delegator # patch rescue ::TypeError obj.is_a?(::Delegator) end ) obj = obj.__getobj__ end # instead of: obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator) # NOTE: # Old implementation can not be used with BasicObject instances # (with Qonfig::Compacted in our case) # NOTE: --- PATCH --- if check_inspect_key(obj) group { obj.pretty_print_cycle self } return end begin push_inspect_key(obj) group { obj.pretty_print self } ensure pop_inspect_key(obj) unless PP.sharing_detection end end