Class: Snackhack2::WebsiteMeta
- Inherits:
-
Object
- Object
- Snackhack2::WebsiteMeta
- Defined in:
- lib/snackhack2/website_meta.rb
Instance Method Summary collapse
-
#initialize(site) ⇒ WebsiteMeta
constructor
A new instance of WebsiteMeta.
- #run ⇒ Object
Constructor Details
#initialize(site) ⇒ WebsiteMeta
Returns a new instance of WebsiteMeta.
7 8 9 |
# File 'lib/snackhack2/website_meta.rb', line 7 def initialize(site) @site = site end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/snackhack2/website_meta.rb', line 11 def run doc = Nokogiri::HTML(URI.open(@site)) posts = doc.xpath('//meta') posts.each do |link| puts "#{link.attributes['name']}: #{link.attributes['content']}" unless link.attributes['name'].nil? end end |