instance method
PP::PPMethods#guard_inspect_key
() { () -> untyped } -> void
guard_inspect_key() { || ... }
lib/pp.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/pp.rb, line 147
def guard_inspect_key
recursive_state = Thread.current[:__recursive_key__] ||= {}.compare_by_identity
save = recursive_state[:inspect] ||= {}.compare_by_identity
begin
recursive_state[:inspect] = {}.compare_by_identity
yield
ensure
recursive_state[: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 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0