refactor hcard for faster testing
This commit is contained in:
parent
e18466e4fa
commit
76e77c2bf1
1 changed files with 9 additions and 2 deletions
11
lib/hcard.rb
11
lib/hcard.rb
|
|
@ -3,11 +3,18 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module HCard
|
||||
def self.find url
|
||||
doc = Nokogiri::HTML(Net::HTTP.get URI.parse(url))
|
||||
def self.fetch url
|
||||
Nokogiri::HTML(Net::HTTP.get URI.parse(url))
|
||||
end
|
||||
|
||||
def self.parse doc
|
||||
{:given_name => doc.css(".given_name").text,
|
||||
:family_name => doc.css(".family_name").text,
|
||||
:url => doc.css("#pod_location").text,
|
||||
:photo => doc.css(".photo[src]").text}
|
||||
end
|
||||
|
||||
def self.find url
|
||||
self.parse self.fetch(url)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue