Class: Newspaper
- Inherits:
-
Object
- Object
- Newspaper
- Defined in:
- lib/newspaper.rb
Instance Attribute Summary collapse
-
#articles ⇒ Object
Returns the value of attribute articles.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
- #add_article(article) ⇒ Object
-
#initialize ⇒ Newspaper
constructor
A new instance of Newspaper.
Constructor Details
#initialize ⇒ Newspaper
Returns a new instance of Newspaper.
4 5 6 |
# File 'lib/newspaper.rb', line 4 def initialize @articles = [] end |
Instance Attribute Details
#articles ⇒ Object
Returns the value of attribute articles.
2 3 4 |
# File 'lib/newspaper.rb', line 2 def articles @articles end |
#time ⇒ Object
Returns the value of attribute time.
2 3 4 |
# File 'lib/newspaper.rb', line 2 def time @time end |
Instance Method Details
#add_article(article) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/newspaper.rb', line 8 def add_article(article) if article.is_a? Article @articles << article else raise StandardError end end |