Class: DoctorScrape::Scraper::Duo
- Defined in:
- lib/doctor_scrape/scraper/duo.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#doc, #errors?, #fetch, #initialize, #scrape, #url
Constructor Details
This class inherits a constructor from DoctorScrape::Scraper::Base
Instance Method Details
#parse ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/doctor_scrape/scraper/duo.rb', line 6 def parse doc.search("#main_container table:nth-child(2) tr").each do |el| label, value = el.children.search("td")[0..1].map { |a| a.text.strip.gsub(/\r\n/, '') } case label when /Tittel/ then @data.title = value when /Forfatter/ then @data. = value when /Publisert/ then @data.issued = value when /Permanent/ then @data.permalink = value end end @data.pdf = link "#main_container table:nth-child(2) + p a" @data.abstract = text "#main_container p:last" end |