class APWArticles::Article
Attributes
blurb[RW]
categories[RW]
title[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/apw_articles/article.rb, line 29 def self.all @@all end
new(attribute_hash)
click to toggle source
# File lib/apw_articles/article.rb, line 5 def initialize(attribute_hash) self.categories = [] attribute_hash.each do |key, value| if key == :categories value.each do |category| c = APWArticles::Category.find_or_create_by_url(category) self.categories << c c.articles << self end else self.send(("#{key}="), value) end @@all << self end end
new_from_list(list_url)
click to toggle source
# File lib/apw_articles/article.rb, line 25 def self.new_from_list(list_url) # call scraper for list and then initalize from hash end
new_from_url(url)
click to toggle source
# File lib/apw_articles/article.rb, line 21 def self.new_from_url(url) self.new(APWArticles::Scraper.scrape_article(url)) end