Class: TestCaseGenerator::IndentedWriter
- Inherits:
-
Object
- Object
- TestCaseGenerator::IndentedWriter
- Defined in:
- lib/test_case_generator/generator_objective_c.rb
Instance Method Summary collapse
- #blank ⇒ Object
- #block_indent(txt) ⇒ Object
- #indent(txt) ⇒ Object
-
#initialize(out) ⇒ IndentedWriter
constructor
A new instance of IndentedWriter.
- #puts(line) ⇒ Object
- #unindent ⇒ Object
Constructor Details
#initialize(out) ⇒ IndentedWriter
Returns a new instance of IndentedWriter.
5 6 7 8 9 |
# File 'lib/test_case_generator/generator_objective_c.rb', line 5 def initialize(out) @out = out @indent = [] @current_indent = '' end |
Instance Method Details
#blank ⇒ Object
15 16 17 |
# File 'lib/test_case_generator/generator_objective_c.rb', line 15 def blank @out.puts end |
#block_indent(txt) ⇒ Object
28 29 30 31 32 |
# File 'lib/test_case_generator/generator_objective_c.rb', line 28 def block_indent(txt) indent txt yield unindent end |
#indent(txt) ⇒ Object
19 20 21 22 |
# File 'lib/test_case_generator/generator_objective_c.rb', line 19 def indent(txt) @indent.push @current_indent @current_indent += txt end |
#puts(line) ⇒ Object
11 12 13 |
# File 'lib/test_case_generator/generator_objective_c.rb', line 11 def puts(line) @out.puts @current_indent + line end |
#unindent ⇒ Object
24 25 26 |
# File 'lib/test_case_generator/generator_objective_c.rb', line 24 def unindent @current_indent = @indent.pop end |