Class: ScrapeGot::CLI
- Inherits:
-
Object
- Object
- ScrapeGot::CLI
- Defined in:
- lib/scrape_got/cli.rb
Instance Method Summary collapse
- #display_line ⇒ Object
- #display_menu_message ⇒ Object
- #end_program ⇒ Object
- #greeting ⇒ Object
- #menu ⇒ Object
- #run ⇒ Object
Instance Method Details
#display_line ⇒ Object
49 50 51 |
# File 'lib/scrape_got/cli.rb', line 49 def display_line puts "___________________________________\n".colorize(:light_yellow) end |
#display_menu_message ⇒ Object
45 46 47 |
# File 'lib/scrape_got/cli.rb', line 45 def puts "Please enter a menu item number or type " + "exit".colorize(:red) + " to exit the program" end |
#end_program ⇒ Object
53 54 55 56 |
# File 'lib/scrape_got/cli.rb', line 53 def end_program puts "Thanks for checking out I scrape and I know things, see ya soon!".colorize(:light_yellow) display_line end |
#greeting ⇒ Object
31 32 33 |
# File 'lib/scrape_got/cli.rb', line 31 def greeting puts " ... Welcome to ... \n I scrape and I know things!\n ".colorize(:light_yellow) end |
#menu ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/scrape_got/cli.rb', line 35 def display_line puts "Please choose an option: " puts " 1. List All Books\n 2. List 20 Houses\n MENU\n display_menu_message\nend\n" |
#run ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/scrape_got/cli.rb', line 6 def run system("clear") greeting Books.all_books Houses.all_houses @user_input = nil while @user_input != "exit" @user_input = gets.strip.downcase if @user_input == "1" puts "List Books:".colorize(:light_yellow) Books.print_books elsif @user_input == "2" puts "List Houses:".colorize(:light_yellow) Houses.print_houses else @user_input == "exit" ? break : end end end_program end |