lib/spidr/body.rb in spidr-0.3.1 vs lib/spidr/body.rb in spidr-0.3.2

- old
+ new

@@ -22,19 +22,18 @@ # # @see http://nokogiri.rubyforge.org/nokogiri/Nokogiri/XML/Document.html # @see http://nokogiri.rubyforge.org/nokogiri/Nokogiri/HTML/Document.html # def doc - return nil if body.empty? - - begin - if html? - return @doc ||= Nokogiri::HTML(body) - elsif (xml? || xsl? || rss? || atom?) - return @doc ||= Nokogiri::XML(body) + unless body.empty? + begin + if html? + @doc ||= Nokogiri::HTML(body) + elsif (rss? || atom? || xml? || xsl?) + @doc ||= Nokogiri::XML(body) + end + rescue end - rescue - return nil end end # # Searches the document for XPath or CSS Path paths.