class TivoHelper::CLI
Public Instance Methods
call()
click to toggle source
# File lib/tivo_helper/cli.rb, line 3 def call TivoHelper::Scraper.new.make_shows puts "Welcome to the Tivo Helper!" menu goodbye end
check_genres()
click to toggle source
# File lib/tivo_helper/cli.rb, line 90 def check_genres puts "Would you like to look at another genre? Y/N/list" answer = gets.chomp if answer == "Y" genre_search elsif answer == "list" list_genres genre_search elsif answer == "N" help end end
check_networks()
click to toggle source
# File lib/tivo_helper/cli.rb, line 103 def check_networks puts "Would you like to look at another network? Y/N/list" answer = gets.chomp if answer == "Y" network_search elsif answer == "list" list_networks network_search elsif answer == "N" help end end
genre_search()
click to toggle source
# File lib/tivo_helper/cli.rb, line 66 def genre_search puts "Please enter one genre to find shows that match." genre_input = gets.chomp puts "" matched_shows = TivoHelper::Show.find_all_by_genre(genre_input) matched_shows.each.with_index(1) do |show, i| puts "#{i}. #{show.name} - #{show.genre} - #{show.network}" end puts "" check_genres end
goodbye()
click to toggle source
# File lib/tivo_helper/cli.rb, line 39 def goodbye puts "Goodbye." end
help()
click to toggle source
# File lib/tivo_helper/cli.rb, line 43 def help puts "How would you like to view your tv premieres?" puts "1. By Time" puts "2. By Genre" puts "3. By Network" puts "" puts "Please enter the number of your choice." puts "Or type exit to leave the program." puts "" end
list_genres()
click to toggle source
# File lib/tivo_helper/cli.rb, line 78 def list_genres puts "Here are your choices for genre:" puts "#{TivoHelper::Show.genres.join(", ")}" puts "" end
list_networks()
click to toggle source
# File lib/tivo_helper/cli.rb, line 84 def list_networks puts "Here are your choices for network:" puts "#{TivoHelper::Show.networks.join(", ")}" puts "" end
list_shows()
click to toggle source
# File lib/tivo_helper/cli.rb, line 10 def list_shows TivoHelper::Show.all.each.with_index(1) do |show, i| puts "#{i}. #{show.name} - #{show.genre} - #{show.network}" end end
network_search()
click to toggle source
# File lib/tivo_helper/cli.rb, line 54 def network_search puts "Please enter one network to find shows that match." network_input = gets.chomp puts "" matched_shows = TivoHelper::Show.find_all_by_network(network_input) matched_shows.each.with_index(1) do |show, i| puts "#{i}. #{show.name} - #{show.genre} - #{show.network}" end puts "" check_networks end