Class: NewsReader::CLI
- Inherits:
-
Object
- Object
- NewsReader::CLI
- Defined in:
- lib/news_reader/cli.rb
Constant Summary collapse
- APP_NAME =
"News Reader CLI"
Class Method Summary collapse
Class Method Details
.about ⇒ Object
38 39 40 |
# File 'lib/news_reader/cli.rb', line 38 def self.about puts "News Reader CLI app by JGB Solutions. Visit https://jgb.solutions for more." end |
.menu ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/news_reader/cli.rb', line 27 def self. puts "\n" puts "------- Menu --------" puts "Please choose an option from the menu below:" puts " - Type `list` to list all the articles" puts " - Type `read` to read an article" puts " - Type `about` to know more about #{APP_NAME}" puts " - Type `exit` to exit the app." puts "-" end |
.start ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/news_reader/cli.rb', line 3 def self.start NewsReader::Article.import(NewsReader::Scraper.fetch_articles) puts "----- Welcome to the News Reader CLI app! ----" puts "--" input = nil while input != "exit" input = gets.strip case input when 'list' NewsReader::Article.list when 'read' NewsReader::Article.read when 'about' about end end puts "Thanks for using the #{APP_NAME} app!" end |