allows for parsing of html string, file path, or url

This commit is contained in:
Jessica Lynn Suttles 2013-02-04 13:40:33 -08:00
parent c2ac2b53ae
commit 07d510ab7d
3 changed files with 41 additions and 1 deletions

View file

@ -1,5 +1,16 @@
require "nokogiri"
require "open-uri"
require "microformats2/version"
module Microformats2
# Your code goes here...
def self.parse(html)
html = read_html(html)
Nokogiri::HTML(html)
end
def self.read_html(html)
open(html).read
rescue Errno::ENOENT => e
html
end
end