Class: BbcNewsCliGem::FrontPage
- Inherits:
-
Object
- Object
- BbcNewsCliGem::FrontPage
- Defined in:
- lib/bbc_news_cli_gem/front_page.rb
Instance Attribute Summary collapse
-
#articles ⇒ Object
readonly
Returns the value of attribute articles.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
- #display_articles ⇒ Object
-
#initialize(link) ⇒ FrontPage
constructor
A new instance of FrontPage.
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
#articles ⇒ Object (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 |
#link ⇒ Object (readonly)
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_articles ⇒ Object
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 |