Class: CLI
- Inherits:
-
Object
- Object
- CLI
- Defined in:
- lib/fender_guitar_catalogue/cli.rb
Instance Method Summary collapse
Instance Method Details
#anything_else ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fender_guitar_catalogue/cli.rb', line 54 def anything_else puts "Anything else? (Y/N)" input = gets.chomp puts "" if input.downcase == "y" system("clear") Guitar.all.clear elsif input.downcase == "n" puts "Goodbye" else puts "Invalid selection." anything_else end end |
#menu ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fender_guitar_catalogue/cli.rb', line 10 def puts "What would you like to do?" puts "1. View Electric Guitars" puts "2. View Acoustic Guitars" puts "3. View Bass Guitars" puts "4. Exit" input = gets.chomp if input == "1" puts "" Scraper.new.scrape("electric") puts "" show_details elsif input == "2" puts "" Scraper.new.scrape("acoustic") puts "" show_details elsif input == "3" puts "" Scraper.new.scrape("bass") puts "" show_details elsif input == "4" puts "Goodbye" else puts "Invalid selection." end end |
#show_details ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fender_guitar_catalogue/cli.rb', line 40 def show_details puts "Which guitar would you like information on?" input = gets.chomp.to_i puts "" if input > 149 || input < 1 puts "!Invalid selection - Please choose a different model!" puts "" show_details else puts Guitar.all[input-1].item_desc end anything_else end |
#title ⇒ Object
3 4 5 6 7 8 |
# File 'lib/fender_guitar_catalogue/cli.rb', line 3 def title puts "=================================" puts "=====FENDER GUITAR CATALOGUE=====" puts "=================================" end |