Class: Sport
Overview
Lists the latest BBC Sport headlines
Instance Method Summary collapse
- #headlines ⇒ Object
-
#initialize(io = STDOUT) ⇒ Sport
constructor
A new instance of Sport.
Methods included from ShellColors
blue, cyan, green, light_green, paint, red, white, yellow
Constructor Details
#initialize(io = STDOUT) ⇒ Sport
Returns a new instance of Sport.
8 9 10 |
# File 'lib/bbc/sport.rb', line 8 def initialize(io = STDOUT) @io = io end |
Instance Method Details
#headlines ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/bbc/sport.rb', line 12 def headlines data['entries'].each do |item| prompt = yellow item['prompt'].capitalize.ljust(22) headline = item['headline'] @io.puts prompt + headline end end |