Class: Pindo::Executable::Indenter

Inherits:
Array
  • Object
show all
Defined in:
lib/pindo/base/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



206
207
208
209
# File 'lib/pindo/base/executable.rb', line 206

def initialize(io = nil)
  @io = io
  @indent = ' '
end

Instance Attribute Details

#indentFixnum (readonly)



196
197
198
# File 'lib/pindo/base/executable.rb', line 196

def indent
  @indent
end

#ioIO (readonly)



200
201
202
# File 'lib/pindo/base/executable.rb', line 200

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.



218
219
220
221
# File 'lib/pindo/base/executable.rb', line 218

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