Class: GdsDataValidation::ValidationCheckerGenerator::SourceGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/gds-data-validation/validation_generator.rb

Instance Method Summary collapse

Constructor Details

#initializeSourceGenerator

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

#indentObject



18
19
20
# File 'lib/gds-data-validation/validation_generator.rb', line 18

def indent
  @indentLevel += 1
end

#new_lineObject



42
43
44
# File 'lib/gds-data-validation/validation_generator.rb', line 42

def new_line
  @resultString << "\n"
end

#resetObject



50
51
52
# File 'lib/gds-data-validation/validation_generator.rb', line 50

def reset
  @resultString = ""
end

#resultObject



46
47
48
# File 'lib/gds-data-validation/validation_generator.rb', line 46

def result
  @resultString
end

#unindentObject



22
23
24
# File 'lib/gds-data-validation/validation_generator.rb', line 22

def unindent
  @indentLevel -= 1  if @indentLevel > 0
end