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
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
menu() click to toggle source