class Nginxtra::Config::Indentation

Attributes

value[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/nginxtra/config.rb, line 638
def initialize(options = {})
  @value = 0
  @options = options
end

Public Instance Methods

decrement() click to toggle source
# File lib/nginxtra/config.rb, line 651
def decrement
  adjust(-1)
end
done?() click to toggle source
# File lib/nginxtra/config.rb, line 647
def done?
  @value == 0
end
increment() click to toggle source
# File lib/nginxtra/config.rb, line 655
def increment
  adjust(1)
end
indent_size() click to toggle source
# File lib/nginxtra/config.rb, line 643
def indent_size
  @options[:indent_size] || 2
end
to_s() click to toggle source
# File lib/nginxtra/config.rb, line 659
def to_s
  " " * indent_size * @value
end

Private Instance Methods

adjust(amount) click to toggle source
# File lib/nginxtra/config.rb, line 665
def adjust(amount)
  @value += amount
  raise Nginxtra::Error::ConvertFailed, "Missing block end!" if @value < 0
  @value
end