class PrettyPrint::SingleLine
Public Class Methods
new(output, maxwidth=nil, newline=nil)
click to toggle source
# File lib/project/prettyprint.rb, line 343 def initialize(output, maxwidth=nil, newline=nil) @output = output @first = [true] end
Public Instance Methods
breakable(sep=' ', width=nil)
click to toggle source
# File lib/project/prettyprint.rb, line 352 def breakable(sep=' ', width=nil) @output << sep end
first?()
click to toggle source
# File lib/project/prettyprint.rb, line 371 def first? result = @first[-1] @first[-1] = false result end
flush()
click to toggle source
# File lib/project/prettyprint.rb, line 368 def flush end
group(indent=nil, open_obj='', close_obj='', open_width=nil, close_width=nil) { || ... }
click to toggle source
# File lib/project/prettyprint.rb, line 360 def group(indent=nil, open_obj='', close_obj='', open_width=nil, close_width=nil) @first.push true @output << open_obj yield @output << close_obj @first.pop end
nest(indent) { || ... }
click to toggle source
# File lib/project/prettyprint.rb, line 356 def nest(indent) yield end
text(obj, width=nil)
click to toggle source
# File lib/project/prettyprint.rb, line 348 def text(obj, width=nil) @output << obj end