class RogerW3cvalidator::Test
Public Class Methods
new(options={})
click to toggle source
# File lib/roger_w3cvalidator/test.rb, line 7 def initialize(options={}) @options = { :match => ["html/**/*.html"], :skip => [] } @options.update(options) if options end
Public Instance Methods
call(test, options={})
click to toggle source
# File lib/roger_w3cvalidator/test.rb, line 15 def call(test, options={}) options = {}.update(@options).update(options) test.log(self, "Validating all files matching #{options[:match].inspect}") success = true test.get_files(options[:match], options[:skip]).each do |file_path| validator = W3CValidator.new(File.read(file_path)) validator.validate! if !validator.valid test.log(self, "#{file_path} is invalid (errors: #{validator.errors}, warnings: #{validator.warnings})") do validator.response["messages"].each do |message| test.debug(self, message["message"]) end end success = false else test.debug(self, "#{file_path} is valid") end end success end