Class: Sport

Inherits:
Object
  • Object
show all
Includes:
ShellColors
Defined in:
lib/bbc/sport.rb

Overview

Lists the latest BBC Sport headlines

Instance Method Summary collapse

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

#headlinesObject



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