class Horror::Movie::Cli

Public Instance Methods

another_movie?() click to toggle source
# File lib/horror/movie/cli.rb, line 85
def another_movie?
  input = gets.strip.downcase
    until input == "yes" || input == "no" || input == "exit"
      puts ""
      puts "------------------------------------------------".colorize :red
      puts "Invalid answer.".colorize :red
      puts ""
       input = gets.strip.downcase
    end
  if input == "yes"
    main_program
  elsif input == "no" || input == "exit"
    goodbye
  end
end
correct_number?() click to toggle source
# File lib/horror/movie/cli.rb, line 49
def correct_number?
    input = gets.strip
    until input.downcase == "no" || (1..25).include?(input.to_i) || input.downcase == "exit"
            puts ""
      puts "------------------------------------------------".colorize :red
      puts "Invalid answer.".colorize :red
      puts ""
       input = gets.strip
    end
    if (1..25).include? input.to_i
            movie = Horror::Movie::Listing.find(input.to_i)
                      print_movie(movie)
                      return movie
              elsif input.downcase == "no" || input.downcase == "exit"
                      goodbye
              end
      end
goodbye() click to toggle source
# File lib/horror/movie/cli.rb, line 136
def goodbye
        puts ""
        puts "------------------------------------------------".colorize :red
        puts "Thank you for your interest. Have a spooky day!".colorize :red
        puts ""
        puts ""
         puts File.read("lib/horror/movie/skull.txt").colorize :red
         puts ""
         puts "------------------------------------------------".colorize :red
        exit
end
main_program() click to toggle source
# File lib/horror/movie/cli.rb, line 17
def main_program

  print_movies

  puts "------------------------------------------------".colorize :red
  puts ""
              puts "Would you like further information on a movie?".colorize :red
  puts ""
  puts "------------------------------------------------".colorize :red
              puts "If yes, please enter a number 1-25.".colorize :red
              puts "If not, please enter no.".colorize :red
              puts ""

              movie = correct_number?

              puts "------------------------------------------------".colorize :red
              puts "Would you like to see the movie's summary and a random review?".colorize :red
              puts ""
              puts "Please enter yes or no.".colorize :red
              puts ""

              summary_and_review?(movie)

              puts ""
              puts "Would you like to see information on another movie?".colorize :red
              puts ""
              puts "Please enter yes or no.".colorize :red
              puts ""

              another_movie?
            end
print_movie(movie) click to toggle source
print_movie_info(movie) click to toggle source
print_movies() click to toggle source
summary_and_review?(movie) click to toggle source
# File lib/horror/movie/cli.rb, line 68
def summary_and_review?(movie)
    input = gets.strip.downcase
    until input == "yes" || input == "no" || input == "exit"
      puts ""
      puts "------------------------------------------------".colorize :red
      puts "Invalid answer.".colorize :red
      puts ""
       input = gets.strip.downcase
    end
  if input == "yes"
    print_movie_info(movie)
  elsif input == "no"
  elsif input == "exit"
    goodbye
  end
end
welcome() click to toggle source
# File lib/horror/movie/cli.rb, line 8
def welcome
  Horror::Movie::Scraper.new.scrape_horror_movies
  puts File.read("lib/horror/movie/intro.txt").colorize :red
  puts ""
  puts "Hello! Welcome to the Rotten Tomatoes: Top 25 Horror Movies List.".colorize :red
  puts ""
  main_program
end