Maintenance Ruby 3.4 gets fixes, but no new features. 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-3.4.1/lib/pp.rb, line 303
def pp_hash_pair(k, v)
if Symbol === k
sym_s = k.inspect
if sym_s[1].match?(/["$@!]/) || sym_s[-1].match?(/[%&*+\-\/<=>@\]^`|~]/)
text "#{k.to_s.inspect}:"
else
text "#{k}:"
end
else
pp k
text ' '
text '=>'
end
group(1) {
breakable
pp v
}
end
A pretty print for a pair of Hash