Sha256: b59de1397b3278dff71ee24e906335898ac9b6fc9f40cc335080f8d5d5ec62b6
Contents?: true
Size: 658 Bytes
Versions: 5
Compression:
Stored size: 658 Bytes
Contents
class DeveloperNewsCliApp::AListApartScrapper @@all = [] def get_page Nokogiri::HTML(open("https://alistapart.com/articles")) end def get_articles self.get_page.css(".entry-list") end def make_article self.get_articles.each do |article| a = DeveloperNewsCliApp::Article.new a.title = article.css(".entry-title a").text a.author = article.css(".author").text a.date = article.css("time").text a.trailing = article.css("p")[1].text a.url = "https://alistapart.com" + article.css(".entry-title a").attribute("href").value @@all << a end end def self.articles @@all end def self.article_count @@all.count end end
Version data entries
5 entries across 5 versions & 1 rubygems