class MovieGem::CLI
Public Instance Methods
display_synopsis()
click to toggle source
# File lib/movie_gem/CLI.rb, line 39 def display_synopsis @object = Movie.all @object.each.with_index(1) do |movie, i| puts "#{i}. #{movie.synopsis}" end end
movie_list()
click to toggle source
# File lib/movie_gem/CLI.rb, line 30 def movie_list @object = Movie.all @object.each.with_index(1) do |movie, i| puts "#{i}. #{movie.title}" end prompt_for_movie_choice end
prompt_for_movie_choice()
click to toggle source
# File lib/movie_gem/CLI.rb, line 46 def prompt_for_movie_choice puts "Which movie would you like more info about?" puts "Pick a number" @input = gets.chomp index = @input.to_i-1 if index >= 0 puts Movie.all[@input.to_i-1].synopsis end menu end
start()
click to toggle source
# File lib/movie_gem/CLI.rb, line 5 def start puts "Welcome to MovieGem" Movie.load menu input = nil while @input != "exit" @input = gets.chomp if @input == "menu" menu elsif @input == "1" movie_list puts "display's a list of movies" elsif @input == "2" display_synopsis puts "display_synopsis" end end puts "Thanks for checking out our MovieGem" end