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.
639 640 641 642 |
# File 'lib/nginxtra/config.rb', line 639 def initialize( = {}) @value = 0 @options = end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
637 638 639 |
# File 'lib/nginxtra/config.rb', line 637 def value @value end |
Instance Method Details
#+(amount) ⇒ Object
656 657 658 659 660 |
# File 'lib/nginxtra/config.rb', line 656 def +(amount) @value += amount raise Nginxtra::Error::ConvertFailed.new("Missing block end!") if @value < 0 @value end |
#-(amount) ⇒ Object
652 653 654 |
# File 'lib/nginxtra/config.rb', line 652 def -(amount) self + (-amount) end |
#done? ⇒ Boolean
648 649 650 |
# File 'lib/nginxtra/config.rb', line 648 def done? @value == 0 end |
#indent_size ⇒ Object
644 645 646 |
# File 'lib/nginxtra/config.rb', line 644 def indent_size @options[:indent_size] || 2 end |
#to_s ⇒ Object
662 663 664 |
# File 'lib/nginxtra/config.rb', line 662 def to_s " " * indent_size * @value end |