lib/relevance/tarantula/tidy_handler.rb in tarantula-0.3.3 vs lib/relevance/tarantula/tidy_handler.rb in tarantula-0.4.0

- old
+ new

@@ -7,26 +7,31 @@ end if defined? Tidy Tidy.path = ENV['TIDY_PATH'] if ENV['TIDY_PATH'] - class Relevance::Tarantula::TidyHandler - include Relevance::Tarantula - def initialize(options = {}) - @options = {:show_warnings=>true}.merge(options) - end - def handle(result) - response = result.response - return unless response.html? - tidy = Tidy.open(@options) do |tidy| - xml = tidy.clean(response.body) - tidy - end - unless tidy.errors.blank? - error_result = result.dup - error_result.description = "Bad HTML (Tidy)" - error_result.data = tidy.errors.inspect - error_result + module Relevance + module Tarantula + + class TidyHandler + include Relevance::Tarantula + def initialize(options = {}) + @options = {:show_warnings=>true}.merge(options) + end + def handle(result) + response = result.response + return unless response.html? + tidy = Tidy.open(@options) do |tidy| + xml = tidy.clean(response.body) + tidy + end + unless tidy.errors.blank? + error_result = result.dup + error_result.description = "Bad HTML (Tidy)" + error_result.data = tidy.errors.inspect + error_result + end + end end end end end