Class: Erector::Indenting
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Erector::Indenting
- Defined in:
- lib/erector/erect/indenting.rb
Overview
:nodoc:
Constant Summary collapse
- @@indent =
0
Instance Method Summary collapse
- #indent ⇒ Object
- #indented(s) ⇒ Object
- #line(s) ⇒ Object
- #line_in(s) ⇒ Object
- #line_out(s) ⇒ Object
- #set_indent(x) ⇒ Object
Instance Method Details
#indent ⇒ Object
13 14 15 |
# File 'lib/erector/erect/indenting.rb', line 13 def indent [0, @@indent].max end |
#indented(s) ⇒ Object
17 18 19 |
# File 'lib/erector/erect/indenting.rb', line 17 def indented(s) " " * indent + s + "\n" end |
#line(s) ⇒ Object
21 22 23 |
# File 'lib/erector/erect/indenting.rb', line 21 def line(s) indented(s) end |
#line_in(s) ⇒ Object
25 26 27 28 29 |
# File 'lib/erector/erect/indenting.rb', line 25 def line_in(s) s = indented(s) @@indent += 1 s end |
#line_out(s) ⇒ Object
31 32 33 34 |
# File 'lib/erector/erect/indenting.rb', line 31 def line_out(s) @@indent -= 1 indented(s) end |
#set_indent(x) ⇒ Object
8 9 10 11 |
# File 'lib/erector/erect/indenting.rb', line 8 def set_indent(x) @@indent = x self end |