Class: MarvelMovies::CLI
- Inherits:
-
Object
- Object
- MarvelMovies::CLI
- Defined in:
- lib/marvel_movies/cli.rb
Instance Method Summary collapse
- #call ⇒ Object
- #goodbye ⇒ Object
- #list_choices ⇒ Object
- #menu ⇒ Object
- #movie_description_menu(array) ⇒ Object
Instance Method Details
#call ⇒ Object
3 4 5 6 |
# File 'lib/marvel_movies/cli.rb', line 3 def call list_choices end |
#goodbye ⇒ Object
45 46 47 48 49 |
# File 'lib/marvel_movies/cli.rb', line 45 def goodbye puts "" puts "Goodbye and check back later for more Marvel Universe" exit end |
#list_choices ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/marvel_movies/cli.rb', line 8 def list_choices puts "Hello Marvel Fans" puts " 1. Show All Marvel Movies\n 2. Show Upcoming Marvel Movies\n 3. Show Marvel Movies Available Now on DVD\n DOC\nend\n".gsub /^\s*/, '' |
#menu ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/marvel_movies/cli.rb', line 17 def input = nil puts "Please enter the option you would like to see or type exit: " while input != "exit" input = gets.strip.downcase case input when "1" puts "" MarvelMovies::Movie.list_all (MarvelMovies::Movie.all) when "2" puts "" MarvelMovies::Movie.list_upcoming (MarvelMovies::Movie.upcoming) when "3" puts "" MarvelMovies::Movie.list_dvd (MarvelMovies::Movie.dvd) when "exit" goodbye else puts "" puts "Not familiar with that option, please type another option or exit: " end end end |
#movie_description_menu(array) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/marvel_movies/cli.rb', line 51 def (array) input = nil while input != "exit" puts " " puts "Choose the number of the movie you would like more information on, type back to go back to previous menu, or exit: " input = gets.strip.downcase if input.to_i > 0 movie = MarvelMovies::Movie.find_movie(array, input.to_i) movie.profile_scrape puts "Title: #{movie.title}" puts "Release Date: #{movie.release_date}" puts "Rating: #{movie.rating}" puts "Description: #{movie.description}" puts "" elsif input == "back" call elsif input == "exit" goodbye end end end |