Sha256: 7b1ae3cc9710c8a46feedc2ce69f22f2f9447bdba094e3cfc930341bc8633cb6
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
#CLI Controller class TopMovies::CLI def call list_movies menu end def list_movies puts <<-DOC Top movies of all time: IMDB Rotten Tomatoes 1. The Shawshank Redemption 2. The Wizard of Oz DOC @movies = TopMovies::Movie.all_time @movies.each.with_index(1) do |movie, i| puts "#{i}. #{movie.site} - #{movie.name} - #{movie.year}" end end def menu input = nil while input != "exit" puts "Enter the number of the movie you would like to learn more about, type list to list the movies again, or type exit:" input = gets.strip if input.to_i > 0 && input.to_i < 3 the_movie = @movies[input.to_i-1] puts "#{the_movie.site} - #{the_movie.name} - #{the_movie.year}" elsif input == "list" list_movies elsif input == "exit" goodbye else puts "I don't understand. Read the menu and try again." end end end def goodbye puts "See you the next time you are curious!" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
top_movies-0.1.0 | lib/top_movies/cli.rb |