Parent

Files

Class/Module Index [+]

Quicksearch

Chef::Formatters::IndentableOutputStream

Handles basic indentation and colorization tasks

Attributes

current_stream[RW]
err[R]
indent[RW]
line_started[R]
out[R]
semaphore[R]

Public Class Methods

new(out, err) click to toggle source
# File lib/chef/formatters/indentable_output_stream.rb, line 13
def initialize(out, err)
  @out, @err = out, err
  @indent = 0
  @line_started = false
  @semaphore = Mutex.new
end

Public Instance Methods

color(string, *args) click to toggle source

Print text. This will start a new line and indent if necessary but will not terminate the line (future print and puts statements will start off where this print left off).

# File lib/chef/formatters/indentable_output_stream.rb, line 30
def color(string, *args)
  print(string, from_args(args))
end
highline() click to toggle source
# File lib/chef/formatters/indentable_output_stream.rb, line 20
def highline
  @highline ||= begin
    require 'highline'
    HighLine.new
  end
end
puts(string, *args) click to toggle source

Print a line. This will continue from the last start_line or print, or start a new line and indent if necessary.

# File lib/chef/formatters/indentable_output_stream.rb, line 43
def puts(string, *args)
  print(string, from_args(args, :end_line => true))
end
puts_line(string, *args) click to toggle source

Print an entire line from start to end. This will terminate any existing lines and cause indentation.

# File lib/chef/formatters/indentable_output_stream.rb, line 49
def puts_line(string, *args)
  print(string, from_args(args, :start_line => true, :end_line => true))
end
start_line(string, *args) click to toggle source

Print the start of a new line. This will terminate any existing lines and cause indentation but will not move to the next line yet (future ‘print’ and ‘puts’ statements will stay on this line).

# File lib/chef/formatters/indentable_output_stream.rb, line 37
def start_line(string, *args)
  print(string, from_args(args, :start_line => true))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.