Class: ReportHtmlFile

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

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ ReportHtmlFile

Returns a new instance of ReportHtmlFile.



70
71
72
73
74
75
76
# File 'lib/InternalW3cValidation.rb', line 70

def initialize(file_name)
	@error_count = 0
	@file = File.new(file_name, "w+")
	@file.puts "<HTML><BODY>"
	@file.puts "<H1>W3C Validation Results</H1>"
	@file.puts "<UL>"
end

Instance Method Details

#add_error(error) ⇒ Object



78
79
80
81
# File 'lib/InternalW3cValidation.rb', line 78

def add_error(error)
	@error_count += 1
	@file.puts "<LI>#{error}</LI>"
end

#saveObject



83
84
85
86
87
88
# File 'lib/InternalW3cValidation.rb', line 83

def save
	@file.puts "</UL>"
	@file.puts "<H3>There are #{@error_count} w3c errors</H3>"
	@file.puts "</BODY></HTML>"
	@file.close()
end