Class: BbcNewsCliGem::FrontPage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link) ⇒ FrontPage

Returns a new instance of FrontPage.



5
6
7
8
# File 'lib/bbc_news_cli_gem/front_page.rb', line 5

def initialize(link)
  @link = link
  @articles = []
end

Instance Attribute Details

#articlesObject (readonly)

Returns the value of attribute articles.



3
4
5
# File 'lib/bbc_news_cli_gem/front_page.rb', line 3

def articles
  @articles
end

Returns the value of attribute link.



3
4
5
# File 'lib/bbc_news_cli_gem/front_page.rb', line 3

def link
  @link
end

Instance Method Details

#display_articlesObject



10
11
12
13
14
# File 'lib/bbc_news_cli_gem/front_page.rb', line 10

def display_articles
  articles.each_with_index do | article, i |
    puts "#{i+1}. #{article.title}"
  end
end