allows for parsing of html string, file path, or url
This commit is contained in:
parent
c2ac2b53ae
commit
07d510ab7d
3 changed files with 41 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue