class DataFormatter::Indentation

Constants

INDENT_CHARS

Attributes

indent_level[RW]

Public Class Methods

new(args={}) click to toggle source
# File lib/data_formatter/indentation.rb, line 8
def initialize(args={})
  @indent_level = args.fetch(:indent_level, 0)
end

Public Instance Methods

decrease() click to toggle source
# File lib/data_formatter/indentation.rb, line 20
def decrease
  self.indent_level = [indent_level - 1, 0].max
end
increase() click to toggle source
# File lib/data_formatter/indentation.rb, line 16
def increase
  self.indent_level += 1
end
indent(value) click to toggle source
# File lib/data_formatter/indentation.rb, line 12
def indent(value)
  to_s + value.to_s
end
to_s() click to toggle source
# File lib/data_formatter/indentation.rb, line 24
def to_s
  INDENT_CHARS * indent_level 
end