Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
PP::PPMethods#pp_hash_pair
pp_hash_pair(k, v)
lib/pp.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/pp.rb, line 314
def pp_hash_pair(k, v)
if Symbol === k
if k.inspect.match?(%r[\A:["$@!]|[%&*+\-\/<=>@\]^`|~]\z])
k = k.to_s.inspect
end
text "#{k}:"
else
pp k
text ' '
text '=>'
end
group(1) {
breakable
pp v
}
end
A pretty print for a pair of Hash