class Troo::Output

Attributes

count[RW]

Public Class Methods

new() click to toggle source
# File lib/troo/presentation/formatter.rb, line 206
def initialize
  @count = 0
end

Public Instance Methods

indent() { || ... } click to toggle source
# File lib/troo/presentation/formatter.rb, line 225
def indent(&block)
  @count += 1

  yield
ensure
  @count -= 1
end
render(lines) click to toggle source
# File lib/troo/presentation/formatter.rb, line 210
def render(lines)
  Array(lines).each { |line| print indentation + line }
  nil
end
spacer() { || ... } click to toggle source
# File lib/troo/presentation/formatter.rb, line 215
def spacer(&block)
  if block_given?
    print "\n"
    yield
    print "\n"
  else
    print "\n"
  end
end

Private Instance Methods

indentation() click to toggle source
# File lib/troo/presentation/formatter.rb, line 235
def indentation
  ' ' * @count * 4
end