class BoxOffice::CLI

Public Instance Methods

add_attributes_to_movie(user_input) click to toggle source
# File lib/box_office/cli.rb, line 43
def add_attributes_to_movie(user_input)
  movie = BoxOffice::Movie.all[user_input]
  attributes = BoxOffice::Scraper.scrape_movie_page(user_input)
  movie.add_movie_attributes(attributes)
end
display_movie_info(user_input) click to toggle source
# File lib/box_office/cli.rb, line 49
def display_movie_info(user_input)
  movie = BoxOffice::Movie.all[user_input]
  movie.print_info
  puts "---"
end
goodbye() click to toggle source
# File lib/box_office/cli.rb, line 55
def goodbye
  puts "Peace out homie!".colorize(:cyan) + " <3".colorize(:light_red)
end
greeting() click to toggle source
# File lib/box_office/cli.rb, line 10
def greeting
  puts "Greetings and salutations, moviegoer! Here's last weekend's box office results!".colorize(:green)
end
list_movies() click to toggle source
# File lib/box_office/cli.rb, line 14
def list_movies
  puts "---"
  puts "Last Weekend's Box Office:".colorize(:red)
  BoxOffice::Movie.all.each_with_index do |movie, i|
    puts "#{i + 1}.".colorize(:blue) + " #{movie.title}, #{movie.earnings}"
  end
  puts "---"
end
menu() click to toggle source
run() click to toggle source
# File lib/box_office/cli.rb, line 2
def run
  greeting
  @movies_list = BoxOffice::Scraper.scrape_movie_list # Generates movie list right away to avoid scraping list multiple times
  list_movies
  menu
  goodbye
end