Class: TldrNews::Scraper
- Inherits:
-
Object
- Object
- TldrNews::Scraper
- Defined in:
- lib/tldr_news/scraper.rb
Instance Method Summary collapse
- #get_page ⇒ Object
-
#initialize ⇒ Scraper
constructor
A new instance of Scraper.
- #make_articles ⇒ Object
- #scrape_articles ⇒ Object
Constructor Details
#initialize ⇒ Scraper
Returns a new instance of Scraper.
4 5 |
# File 'lib/tldr_news/scraper.rb', line 4 def initialize end |
Instance Method Details
#get_page ⇒ Object
7 8 9 |
# File 'lib/tldr_news/scraper.rb', line 7 def get_page Nokogiri::HTML(open('https://tldrworldnews.com/')) end |
#make_articles ⇒ Object
15 16 17 18 19 |
# File 'lib/tldr_news/scraper.rb', line 15 def make_articles scrape_articles.each do |listing| TldrNews::Article.new_from_html(listing) end end |
#scrape_articles ⇒ Object
11 12 13 |
# File 'lib/tldr_news/scraper.rb', line 11 def scrape_articles self.get_page.css('div.listing') end |