Class: TopTv::CLI
- Inherits:
-
Object
- Object
- TopTv::CLI
- Defined in:
- lib/top_tv/cli.rb
Instance Method Summary collapse
- #call ⇒ Object
- #goodbye ⇒ Object
- #list_show_info(show) ⇒ Object
- #list_shows ⇒ Object
- #main_menu ⇒ Object
Instance Method Details
#call ⇒ Object
3 4 5 6 7 |
# File 'lib/top_tv/cli.rb', line 3 def call list_shows goodbye end |
#goodbye ⇒ Object
66 67 68 69 |
# File 'lib/top_tv/cli.rb', line 66 def goodbye puts "" puts "Goodbye!" end |
#list_show_info(show) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/top_tv/cli.rb', line 54 def list_show_info(show) puts "" puts "~~~ #{show.name} ~~~" puts "" puts "#{show.description}" puts "" puts "Genre: #{show.genre}" puts "Network: #{show.network}" puts "Premiere Date: #{show.premiere_date}" puts "" end |
#list_shows ⇒ Object
20 21 22 23 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 |
# File 'lib/top_tv/cli.rb', line 20 def list_shows puts "" puts "Please enter the corresponding number or enter exit to quit:" input = gets.strip.downcase if input != "exit" puts "" heading = @headings[input.to_i-1] puts "~~~ #{heading.name} ~~~" puts "" the_shows = heading.shows the_shows.each.with_index(1) do |show, i| puts "#{i}. #{show}" end TopTv::Scraper.make_shows puts "" puts "What show would you like more info on?" input = gets.strip.to_i chosen_show = the_shows[input.to_i-1] show = TopTv::Show.find_show_by_name(chosen_show) list_show_info(show) puts "Is there another show that you'd like to learn more about? (y/n)" input = gets.strip.downcase if input == "y" @headings.clear list_shows end end end |