Class: News
- Inherits:
-
Object
- Object
- News
- Defined in:
- lib/bbc/news.rb
Overview
Provides a list of the latest BBC News headlines
Instance Method Summary collapse
-
#initialize(io = STDOUT) ⇒ News
constructor
A new instance of News.
- #load ⇒ Object
Constructor Details
#initialize(io = STDOUT) ⇒ News
Returns a new instance of News.
6 7 8 |
# File 'lib/bbc/news.rb', line 6 def initialize(io = STDOUT) @io = io end |
Instance Method Details
#load ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/bbc/news.rb', line 10 def load cols = console_columns @io.puts 'BBC News Headlines' data['entries'].each do |news_item| @io.puts news_item['headline'][0..cols - 1] end end |