| Class | PrettyPrint::SingleLine |
| In: |
lib/prettyprint.rb
|
| Parent: | Object |
# File lib/prettyprint.rb, line 345
345: def initialize(output, maxwidth=nil, newline=nil)
346: @output = output
347: @first = [true]
348: end
# File lib/prettyprint.rb, line 354
354: def breakable(sep=' ', width=nil)
355: @output << sep
356: end
# File lib/prettyprint.rb, line 373
373: def first?
374: result = @first[-1]
375: @first[-1] = false
376: result
377: end
# File lib/prettyprint.rb, line 362
362: def group(indent=nil, open_obj='', close_obj='', open_width=nil, close_width=nil)
363: @first.push true
364: @output << open_obj
365: yield
366: @output << close_obj
367: @first.pop
368: end