End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
PP::PPMethods#guard_inspect_key
guard_inspect_key() { || ... }
lib/pp.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/pp.rb, line 141
def guard_inspect_key
if Thread.current[:__recursive_key__] == nil
Thread.current[:__recursive_key__] = {}.compare_by_identity
end
if Thread.current[:__recursive_key__][:inspect] == nil
Thread.current[:__recursive_key__][:inspect] = {}.compare_by_identity
end
save = Thread.current[:__recursive_key__][:inspect]
begin
Thread.current[:__recursive_key__][:inspect] = {}.compare_by_identity
yield
ensure
Thread.current[:__recursive_key__][:inspect] = save
end
end
Yields to a block and preserves the previous set of objects being printed.
See also
#comma_breakable
#object_address_group
#check_inspect_key
#object_group
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0