Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • prettyprint.rb

Parent

PrettyPrint::SingleLine

Public Class Methods

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

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.