End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
PP::PPMethods#pp
pp(obj)
lib/pp.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/pp.rb, line 185
def pp(obj)
# If obj is a Delegator then use the object being delegated to for cycle
# detection
obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)
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
Adds obj to the pretty printing buffer using Object#pretty_print or Object#pretty_print_cycle.
Object#pretty_print_cycle is used when obj is already printed, a.k.a the object reference chain has a cycle.
See also
#pop_inspect_key
#pp_hash
#object_group
#pp_object
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0