class KdnuggetsRoundup::Article
Attributes
excerpt[RW]
popular[RW]
summary[RW]
title[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/article.rb, line 38 def self.all @@all end
find_by_title(title)
click to toggle source
# File lib/article.rb, line 18 def self.find_by_title(title) all.detect{|story| story.title == title} end
new(title, url)
click to toggle source
# File lib/article.rb, line 6 def initialize(title, url) @title = title @url = url @popular = false @shared = false @@all << self end
popular()
click to toggle source
# File lib/article.rb, line 30 def self.popular all.select{|a| a.popular} end
Public Instance Methods
add_to_popular()
click to toggle source
# File lib/article.rb, line 22 def add_to_popular @popular = true end
assign_attributes(attribute_hash)
click to toggle source
# File lib/article.rb, line 14 def assign_attributes(attribute_hash) attribute_hash.each{|k, v| self.send("#{k}=", v)} end