Class: Nginxtra::Config::Indentation

Inherits:
Object
  • Object
show all
Defined in:
lib/nginxtra/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Indentation

Returns a new instance of Indentation.



638
639
640
641
# File 'lib/nginxtra/config.rb', line 638

def initialize(options = {})
  @value = 0
  @options = options
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



636
637
638
# File 'lib/nginxtra/config.rb', line 636

def value
  @value
end

Instance Method Details

#decrementObject



651
652
653
# File 'lib/nginxtra/config.rb', line 651

def decrement
  adjust(-1)
end

#done?Boolean

Returns:

  • (Boolean)


647
648
649
# File 'lib/nginxtra/config.rb', line 647

def done?
  @value == 0
end

#incrementObject



655
656
657
# File 'lib/nginxtra/config.rb', line 655

def increment
  adjust(1)
end

#indent_sizeObject



643
644
645
# File 'lib/nginxtra/config.rb', line 643

def indent_size
  @options[:indent_size] || 2
end

#to_sObject



659
660
661
# File 'lib/nginxtra/config.rb', line 659

def to_s
  " " * indent_size * @value
end