Class: GdsDataValidation::ValidationCheckerGenerator::SourceGenerator
- Inherits:
-
Object
- Object
- GdsDataValidation::ValidationCheckerGenerator::SourceGenerator
- Defined in:
- lib/gds-data-validation/validation_generator.rb
Instance Method Summary collapse
- #add(str) ⇒ Object
- #add_line(str) ⇒ Object
- #begin_line(str) ⇒ Object
- #end_line(str) ⇒ Object
- #indent ⇒ Object
-
#initialize ⇒ SourceGenerator
constructor
A new instance of SourceGenerator.
- #new_line ⇒ Object
- #reset ⇒ Object
- #result ⇒ Object
- #unindent ⇒ Object
Constructor Details
#initialize ⇒ SourceGenerator
Returns a new instance of SourceGenerator.
13 14 15 16 |
# File 'lib/gds-data-validation/validation_generator.rb', line 13 def initialize @resultString = "" @indentLevel = 0 end |
Instance Method Details
#add(str) ⇒ Object
26 27 28 |
# File 'lib/gds-data-validation/validation_generator.rb', line 26 def add( str ) @resultString << str end |
#add_line(str) ⇒ Object
30 31 32 |
# File 'lib/gds-data-validation/validation_generator.rb', line 30 def add_line( str ) @resultString << " "*(@indentLevel * 2) + str << "\n" end |
#begin_line(str) ⇒ Object
34 35 36 |
# File 'lib/gds-data-validation/validation_generator.rb', line 34 def begin_line( str ) @resultString << " "*(@indentLevel * 2) + str end |
#end_line(str) ⇒ Object
38 39 40 |
# File 'lib/gds-data-validation/validation_generator.rb', line 38 def end_line( str ) @resultString << str << "\n" end |
#indent ⇒ Object
18 19 20 |
# File 'lib/gds-data-validation/validation_generator.rb', line 18 def indent @indentLevel += 1 end |
#new_line ⇒ Object
42 43 44 |
# File 'lib/gds-data-validation/validation_generator.rb', line 42 def new_line @resultString << "\n" end |
#reset ⇒ Object
50 51 52 |
# File 'lib/gds-data-validation/validation_generator.rb', line 50 def reset @resultString = "" end |
#result ⇒ Object
46 47 48 |
# File 'lib/gds-data-validation/validation_generator.rb', line 46 def result @resultString end |
#unindent ⇒ Object
22 23 24 |
# File 'lib/gds-data-validation/validation_generator.rb', line 22 def unindent @indentLevel -= 1 if @indentLevel > 0 end |