class CLAide::Executable::Indenter

Helper class that allows to write to an {IO} instance taking into account the UI indentation level.

Attributes

indent[RW]

@return [Fixnum] The indentation level of the UI.

io[RW]

@return [IO] the {IO} to which the output should be printed.

Public Class Methods

new(io = nil) click to toggle source

@param [IO] io @see io

# File lib/claide/executable.rb, line 97
def initialize(io = nil)
  @io = io
  @indent = ' ' * UI.indentation_level
end

Public Instance Methods

<<(value) click to toggle source

Stores a portion of the output and prints it to the {IO} instance.

@param [String] value

the output to print.

@return [void]

Calls superclass method
# File lib/claide/executable.rb, line 109
def <<(value)
  super
ensure
  @io << "#{ indent }#{ value }" if @io
end