Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
PrettyPrint.format
format(output=''.dup, maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n}) { |q| ... }
lib/prettyprint.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/prettyprint.rb, line 47
def PrettyPrint.format(output=''.dup, maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n})
q = PrettyPrint.new(output, maxwidth, newline, &genspace)
yield q
q.flush
output
end
This is a convenience method which is same as follows:
Example
begin q = PrettyPrint.new(output, maxwidth, newline, &genspace) ... q.flush output end