Class: GoodNews::Topic
- Inherits:
-
Object
- Object
- GoodNews::Topic
- Defined in:
- lib/good_news/topic.rb
Constant Summary collapse
- @@all =
Class variable stores all topics objects.
[]
Instance Attribute Summary collapse
-
#articles ⇒ Object
Returns the value of attribute articles.
-
#name ⇒ Object
Returns the value of attribute name.
-
#web_addr ⇒ Object
Returns the value of attribute web_addr.
Class Method Summary collapse
-
.all ⇒ Object
Class method to get all topics.
Instance Method Summary collapse
-
#initialize ⇒ Topic
constructor
Instantiates with an article attribute to store all articles of the topic.
-
#save ⇒ Object
Method to save topic object into @@all.
Constructor Details
#initialize ⇒ Topic
Instantiates with an article attribute to store all articles of the topic.
8 9 10 |
# File 'lib/good_news/topic.rb', line 8 def initialize @articles = [] end |
Instance Attribute Details
#articles ⇒ Object
Returns the value of attribute articles.
2 3 4 |
# File 'lib/good_news/topic.rb', line 2 def articles @articles end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/good_news/topic.rb', line 2 def name @name end |
#web_addr ⇒ Object
Returns the value of attribute web_addr.
2 3 4 |
# File 'lib/good_news/topic.rb', line 2 def web_addr @web_addr end |
Class Method Details
.all ⇒ Object
Class method to get all topics.
13 14 15 |
# File 'lib/good_news/topic.rb', line 13 def self.all @@all end |
Instance Method Details
#save ⇒ Object
Method to save topic object into @@all.
18 19 20 |
# File 'lib/good_news/topic.rb', line 18 def save @@all << self end |