Ruby PrettyPrint Functions
EditRocket provides the following information on PrettyPrint functions in the Ruby source code builder.
break_outmost_groups() -
breakable(sep=' ', width=sep.length) - This tells "you can break a line here if necessary", and a width\-column text sep is inserted if a line is not broken at the point.
current_group() -
fill_breakable(sep=' ', width=sep.length) -
first?() - first? is a predicate to test the call is a first call to first? with current group.
flush() - outputs buffered data.
format(output='', maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n} {|q| ...} - "This is a convenience method which is same as follows:"
group(indent=0, open_obj='', close_obj='', open_width=open_obj.length, close_width=close_obj.length) - Groups line break hints added in the block. The line break hints are all to be used or not.
group_sub() -
nest(indent) - Increases left margin after newline with indent for line breaks added in the block.
new(output='', maxwidth=79, newline="\n", &genspace) - Creates a buffer for pretty printing.
singleline_format(output='', maxwidth=nil, newline=nil, genspace=nil) - This is similar to PrettyPrint::format but the result has no breaks.
text(obj, width=obj.length) - This adds obj as a text of width columns in width.