We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dd11fe commit 674e2caCopy full SHA for 674e2ca
lib/pp.rb
@@ -313,12 +313,10 @@ def pp_hash(obj)
313
# A pretty print for a pair of Hash
314
def pp_hash_pair(k, v)
315
if Symbol === k
316
- sym_s = k.inspect
317
- if sym_s[1].match?(/["$@!]/) || sym_s[-1].match?(/[%&*+\-\/<=>@\]^`|~]/)
318
- text "#{k.to_s.inspect}:"
319
- else
320
- text "#{k}:"
+ if k.inspect.match?(%r[\A:["$@!]|[%&*+\-\/<=>@\]^`|~]\z])
+ k = k.to_s.inspect
321
end
+ text "#{k}:"
322
else
323
pp k
324
text ' '
0 commit comments