We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New hash syntax was introduced in ruby 1.9 around 2009 (14 years ago?)
this patch will use new syntax when possible and add spaces around =>
=>
What do you think about making this as default behavior?
module PP::PPMethods def pp_hash(obj) group(1, '{', '}') { seplist(obj, nil, :each_pair) {|key, v| group { if key.is_a?(Symbol) if key.to_s =~ /^[\w_][\w\d_]+$/i text "#{key}: " else text "'#{key}': " end else pp key text ' => ' end group(1) { breakable '' pp v } } } } end end # example: pp( "string key" => 1111, "33 symbol .": 222, symbol: 333, sub: { hash: { _aaa_aaaa_111: 444, something_else: "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsiZ29qZWsiLCJtaWR0cmFucyIsImdvdml", "and" => "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsiZ29qZWsiLCJtaWR0cmFucyIsImdvdml" } } ) # prints {"string key" => 1111, '33 symbol .': 222, symbol: 333, sub: {hash: {_aaa_aaaa_111: 444, something_else: "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsiZ29qZWsiLCJtaWR0cmFucyIsImdvdml", "and" => "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsiZ29qZWsiLCJtaWR0cmFucyIsImdvdml"}}}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
New hash syntax was introduced in ruby 1.9 around 2009 (14 years ago?)
this patch will use new syntax when possible and add spaces around
=>
What do you think about making this as default behavior?
The text was updated successfully, but these errors were encountered: