Class: Nginxtra::Config::Indentation
- Inherits:
-
Object
- Object
- Nginxtra::Config::Indentation
- Defined in:
- lib/nginxtra/config.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #+(amount) ⇒ Object
- #-(amount) ⇒ Object
- #done? ⇒ Boolean
- #indent_size ⇒ Object
-
#initialize(options = {}) ⇒ Indentation
constructor
A new instance of Indentation.
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Indentation
Returns a new instance of Indentation.
643 644 645 646 |
# File 'lib/nginxtra/config.rb', line 643 def initialize( = {}) @value = 0 @options = end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
641 642 643 |
# File 'lib/nginxtra/config.rb', line 641 def value @value end |
Instance Method Details
#+(amount) ⇒ Object
660 661 662 663 664 |
# File 'lib/nginxtra/config.rb', line 660 def +(amount) @value += amount raise Nginxtra::Error::ConvertFailed.new("Missing block end!") if @value < 0 @value end |
#-(amount) ⇒ Object
656 657 658 |
# File 'lib/nginxtra/config.rb', line 656 def -(amount) self + (-amount) end |
#done? ⇒ Boolean
652 653 654 |
# File 'lib/nginxtra/config.rb', line 652 def done? @value == 0 end |
#indent_size ⇒ Object
648 649 650 |
# File 'lib/nginxtra/config.rb', line 648 def indent_size @options[:indent_size] || 2 end |
#to_s ⇒ Object
666 667 668 |
# File 'lib/nginxtra/config.rb', line 666 def to_s " " * indent_size * @value end |