This class implements a pretty printing algorithm. It finds line breaks and nice indentations for grouped structure.
Creates a new pretty printer that will write to the given output and be capped at maxwidth.
Pretty prints obj into io with the given width as a limit and starting with the given indentation.
Creates a pretty printer and yields it to the block, appending any output to the given io.
Appends an element that can turn into a newline if necessary.
Same as:
Similar to #breakable
except the decision to break or not is determined individually.
Outputs any buffered data.
Creates a group of objects.
Appends a list of elements surrounded by left and right and separated by commas, yielding each element to the given block.
Appends a list of elements surrounded by left and right and separated by commas.
Increases the indentation for breakables inside the current group.
Appends a group that is surrounded by the given left and right objects, and optionally is surrounded by the given breakable objects.
Appends a text element.
Reference
Reference
Object
Object
Creates a new pretty printer that will write to the given output and be capped at maxwidth.
Pretty prints obj into io with the given width as a limit and starting with the given indentation.
Creates a pretty printer and yields it to the block, appending any output to the given io.
Appends an element that can turn into a newline if necessary.
Same as:
text "," breakable
Similar to #breakable
except the decision to break or not is determined individually.
Outputs any buffered data.
Creates a group of objects. Inside a group all breakable objects are either turned into newlines or are output as is, depending on the available width.
Appends a list of elements surrounded by left and right and separated by commas, yielding each element to the given block.
Appends a list of elements surrounded by left and right and separated by commas.
Increases the indentation for breakables inside the current group.
Appends a group that is surrounded by the given left and right objects, and optionally is surrounded by the given breakable objects.
Appends a text element.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/PrettyPrint.html