class method
PrettyPrint.format
(?untyped output, ?::Integer maxwidth, ?::String newline, ?^(::Integer) -> ::Integer genspace) { (::PrettyPrint) -> untyped } -> ::PrettyPrint::_Output
format(output=''.dup, maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n}) { |q| ... }
lib/prettyprint.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prettyprint.rb, line 48
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