Class: Newspaper

Inherits:
Object
  • Object
show all
Defined in:
lib/newspaper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNewspaper

Returns a new instance of Newspaper.



4
5
6
# File 'lib/newspaper.rb', line 4

def initialize
    @articles = []
end

Instance Attribute Details

#articlesObject

Returns the value of attribute articles.



2
3
4
# File 'lib/newspaper.rb', line 2

def articles
  @articles
end

#timeObject

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