24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/nfl_top_stories/concerns/headline_choice.rb', line 24
def get_choice(source)
puts "\033[0;36mWhich story would you like to read?\033[0m"
puts "0. Back to the main menu"
@headlines.each.with_index(1) do |headline, i|
puts "#{i}. #{headline.title}"
end
case source
when "espn"
get_source = "espn_stories"
when "nfl"
get_source = "nfl_stories"
when "cbs"
get_source = "cbs_stories"
when "fox"
get_source = "fox_stories"
when "usa"
get_source = "usa_stories"
end
input = gets.strip.downcase
if input == "0"
puts ""
CLI.new.call
elsif input == "1"
Story.send(get_source, @headlines[0].url)
elsif input == "2"
Story.send(get_source, @headlines[1].url)
elsif input == "3"
Story.send(get_source, @headlines[2].url)
elsif input == "4"
Story.send(get_source, @headlines[3].url)
elsif input == "5"
Story.send(get_source, @headlines[4].url)
elsif input == "6"
Story.send(get_source, @headlines[5].url)
else
puts ""
puts "\033[0;33mInvalid entry...\033[0m"
get_choice(source)
end
end
|