Class: Pod::Executable::Indenter

Inherits:
Array
  • Object
show all
Defined in:
lib/cocoapods/executable.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io = nil) ⇒ Indenter

Init a new Indenter

Parameters:

  • io (IO) (defaults to: nil)

    @see io



156
157
158
159
# File 'lib/cocoapods/executable.rb', line 156

def initialize(io = nil)
  @io = io
  @indent = ' ' * UI.indentation_level
end

Instance Attribute Details

#indentFixnum

Returns The indentation level of the UI.

Returns:

  • (Fixnum)

    The indentation level of the UI.



146
147
148
# File 'lib/cocoapods/executable.rb', line 146

def indent
  @indent
end

#ioIO

Returns the IO to which the output should be printed.

Returns:

  • (IO)

    the IO to which the output should be printed.



150
151
152
# File 'lib/cocoapods/executable.rb', line 150

def io
  @io
end

Instance Method Details

#<<(value) ⇒ void

This method returns an undefined value.

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

Parameters:

  • value (String)

    the output to print.



168
169
170
171
# File 'lib/cocoapods/executable.rb', line 168

def <<(value)
  super
  io << "#{ indent }#{ value }" if io
end