class PrettyPrint::SingleLine

Public Class Methods

new(output, maxwidth=nil, newline=nil) click to toggle source
# File lib/prettyprint.rb, line 361
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/prettyprint.rb, line 370
def breakable(sep=' ', width=nil)
  @output << sep
end
first?() click to toggle source
# File lib/prettyprint.rb, line 389
def first?
  result = @first[-1]
  @first[-1] = false
  result
end
flush() click to toggle source
# File lib/prettyprint.rb, line 386
def flush
end
group(indent=nil, open_obj='', close_obj='', open_width=nil, close_width=nil) { || ... } click to toggle source
# File lib/prettyprint.rb, line 378
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/prettyprint.rb, line 374
def nest(indent)
  yield
end
text(obj, width=nil) click to toggle source
# File lib/prettyprint.rb, line 366
def text(obj, width=nil)
  @output << obj
end