method
new
v1_8_7_72 -
Show latest stable
- Class:
PrettyPrint
new(output='', maxwidth=79, newline="\\n", &genspace)public
Creates a buffer for pretty printing.
output is an output target. If it is not specified, ’’ is assumed. It should have a << method which accepts the first argument obj of PrettyPrint#text, the first argument sep of PrettyPrint#breakable, the first argument newline of PrettyPrint.new, and the result of a given block for PrettyPrint.new.
maxwidth specifies maximum line length. If it is not specified, 79 is assumed. However actual outputs may overflow maxwidth if long non-breakable texts are provided.
newline is used for line breaks. "\n" is used if it is not specified.
The block is used to generate spaces. {|width| ’ ’ * width} is used if it is not given.