Extracting hpricot_document method

This commit is contained in:
Bryan Helmkamp 2008-11-27 00:33:11 -05:00
parent b1ef30c71d
commit e7ddb4bdd1

View File

@ -5,6 +5,11 @@ module Webrat #:nodoc:
if Webrat.configuration.parse_with_nokogiri? if Webrat.configuration.parse_with_nokogiri?
Webrat.nokogiri_document(stringlike) Webrat.nokogiri_document(stringlike)
else else
Webrat::XML.hpricot_document(stringlike)
end
end
def self.hpricot_document(stringlike)
return stringlike.dom if stringlike.respond_to?(:dom) return stringlike.dom if stringlike.respond_to?(:dom)
if Hpricot::Doc === stringlike if Hpricot::Doc === stringlike
@ -19,7 +24,6 @@ module Webrat #:nodoc:
Hpricot(stringlike.to_s) Hpricot(stringlike.to_s)
end end
end end
end
def self.css_search(element, *searches) #:nodoc: def self.css_search(element, *searches) #:nodoc:
if Webrat.configuration.parse_with_nokogiri? if Webrat.configuration.parse_with_nokogiri?