lib/mida/document.rb in mida-0.3.9 vs lib/mida/document.rb in mida-0.4.0
- old
+ new
@@ -14,10 +14,10 @@
#
# [target] The string containing the html that you want to parse.
# [page_url] The url of target used for form absolute urls. This must
# include the filename, e.g. index.html.
def initialize(target, page_url=nil)
- @doc = Nokogiri(target)
+ @doc = target.kind_of?(Nokogiri::XML::Document) ? target : Nokogiri(target)
@page_url = page_url
@items = extract_items
end
# Implements method for Enumerable