Class: Relevance::Tarantula::InvalidHtmlHandler
- Includes:
- Relevance::Tarantula
- Defined in:
- lib/relevance/tarantula/invalid_html_handler.rb
Constant Summary
Constants included from Relevance::Tarantula
Instance Method Summary collapse
Methods included from Relevance::Tarantula
#log, #rails_root, #tarantula_home, #verbose
Instance Method Details
#handle(result) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/relevance/tarantula/invalid_html_handler.rb', line 6 def handle(result) response = result.response unless response.html? log "Skipping #{self.class} on url: #{result.url} because response is not html." return end begin body = HTML::Document.new(response.body, true) rescue Exception => e error_result = result.dup error_result.success = false error_result.description = "Bad HTML (Scanner)" error_result.data = e. error_result else nil end end |