class Top10BoxOffice::CLI

Public Instance Methods

call() click to toggle source
# File lib/top_10_box_office/cli.rb, line 3
def call
  Top10BoxOffice::Scraper.new.get_movies 
  puts "----------------------------------------------------------------------------"
  puts "                     #{Top10BoxOffice::Movie.date}                          ".light_green
  puts "----------------------------------------------------------------------------"
  puts

  start
end
movie_information() click to toggle source
# File lib/top_10_box_office/cli.rb, line 33
def movie_information
  puts "\nEnter movie number for more details:".light_green
  print "[1 - 10] $ ".light_red
  input = gets.chomp.to_i

  input.between?(1, 10) ? print_movie_details(input) : movie_information 
end
print_list() click to toggle source
print_movie_details(input) click to toggle source
start() click to toggle source
# File lib/top_10_box_office/cli.rb, line 13
def start
  puts "Please enter a command:".light_green
  puts " - Enter 'L' to view a list of the current top box office movies"
  puts " - Enter 'Q' to quit the program"
  print "\n['L'ist / 'Q'uit] $ ".light_red
  input = gets.chomp.downcase
  puts

  if input == "l" || input == "list"
    print_list
    movie_information
  elsif input.downcase == "q"
    puts "Goodbye!"
    puts "...and keep the change, ya filthy animal!".light_magenta
    puts
  else
    start
  end
end