Class: HtmlErrorReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/InternalW3cValidation.rb

Instance Method Summary collapse

Constructor Details

#initialize(output_file_name) ⇒ HtmlErrorReporter

Returns a new instance of HtmlErrorReporter.



47
48
49
50
51
52
53
54
# File 'lib/InternalW3cValidation.rb', line 47

def initialize(output_file_name)
  @error_count = 0
  @output_file_name = output_file_name
  dirname = File.dirname(output_file_name)
  puts dirname
  FileUtils.mkdir_p(dirname)
  @report_html_file = ReportHtmlFile.new(output_file_name)
end

Instance Method Details

#endObject



61
62
63
64
65
66
# File 'lib/InternalW3cValidation.rb', line 61

def end
  @report_html_file.save
  puts "--------------------------------------------------------------------------------------"
  puts "There are #{@error_count} W3c Validation Errors (see #{@output_file_name} for details)"
  puts "--------------------------------------------------------------------------------------"
end

#show(error) ⇒ Object



56
57
58
59
# File 'lib/InternalW3cValidation.rb', line 56

def show(error)
  @error_count += 1
  @report_html_file.add_error(error)
end