diff options
Diffstat (limited to 'guides/w3c_validator.rb')
-rw-r--r-- | guides/w3c_validator.rb | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/guides/w3c_validator.rb b/guides/w3c_validator.rb index 6eddd08906..aad9ac2608 100644 --- a/guides/w3c_validator.rb +++ b/guides/w3c_validator.rb @@ -57,39 +57,39 @@ module RailsGuides end private - def guides_to_validate - guides = Dir["./output/*.html"] - guides.delete("./output/layout.html") - guides.delete("./output/_license.html") - guides.delete("./output/_welcome.html") - ENV.key?("ONLY") ? select_only(guides) : guides - end + def guides_to_validate + guides = Dir["./output/*.html"] + guides.delete("./output/layout.html") + guides.delete("./output/_license.html") + guides.delete("./output/_welcome.html") + ENV.key?("ONLY") ? select_only(guides) : guides + end - def select_only(guides) - prefixes = ENV["ONLY"].split(",").map(&:strip) - guides.select do |guide| - prefixes.any? {|p| guide.start_with?("./output/#{p}")} + def select_only(guides) + prefixes = ENV["ONLY"].split(",").map(&:strip) + guides.select do |guide| + prefixes.any? {|p| guide.start_with?("./output/#{p}")} + end end - end - def show_results(error_list) - if error_list.size == 0 - puts "\n\nAll checked guides validate OK!" - else - error_summary = error_detail = "" + def show_results(error_list) + if error_list.size == 0 + puts "\n\nAll checked guides validate OK!" + else + error_summary = error_detail = "" - error_list.each_pair do |name, errors| - error_summary += "\n #{name}" - error_detail += "\n\n #{name} has #{errors.size} validation error(s):\n" - errors.each do |error| - error_detail += "\n "+error.to_s.delete("\n") + error_list.each_pair do |name, errors| + error_summary += "\n #{name}" + error_detail += "\n\n #{name} has #{errors.size} validation error(s):\n" + errors.each do |error| + error_detail += "\n "+error.to_s.delete("\n") + end end - end - puts "\n\nThere are #{error_list.size} guides with validation errors:\n" + error_summary - puts "\nHere are the detailed errors for each guide:" + error_detail + puts "\n\nThere are #{error_list.size} guides with validation errors:\n" + error_summary + puts "\nHere are the detailed errors for each guide:" + error_detail + end end - end end end |