11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/tmxnews/cli.rb', line 11
def
hello
@article = Tmxnews::Article.list_articles
input = nil
while input != "exit"
puts "Enter the number of the article you would like to read or type 'exit' to end the program."
input = gets.strip.downcase
if input.to_i > 0
the_article = @article[input.to_i-1]
puts "Headline: #{the_article.title}"
puts "Summary: #{the_article.text}"
puts "URL: #{the_article.url}"
elsif input == "exit"
good_bye
else
puts "Please type 'exit' or select an article number."
end
end
end
|