Class: Fourflusher::Executable::Indenter

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



221
222
223
224
# File 'lib/fourflusher/executable.rb', line 221

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

Instance Attribute Details

#indentFixnum



211
212
213
# File 'lib/fourflusher/executable.rb', line 211

def indent
  @indent
end

#ioIO



215
216
217
# File 'lib/fourflusher/executable.rb', line 215

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.



233
234
235
236
# File 'lib/fourflusher/executable.rb', line 233

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