Actions
Feature #12664
closedMultiline pretty-printing of multiline strings
Description
With following addition
class String
def pretty_print(q)
lines = self.lines
if lines.size > 1
q.group(0, '', '') do
q.seplist(lines, lambda { q.text ' +'; q.breakable }) do |v|
q.pp v
end
end
else
q.text inspect
end
end
end
a multiline String will print as follows
[9] pry(main)> pp "bundler.rb"=> "module Bundler\n BundlerError = Class.new(Exception)\n def self.setup\n end\nend\n"
{"bundler.rb"=>
"module Bundler\n" +
" BundlerError = Class.new(Exception)\n" +
" def self.setup\n" +
" end\n" +
"end\n"}
Actions
Like0
Like0Like0Like0Like0Like0