Sha256: 5544cbe6af9d640860bfd8b6828bf144c6c5650d7753e520f7fcf721be59eb6f
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
class ComingSoon::CLI def call get_and_list_movies menu_selection end def get_and_list_movies puts '' puts ' **********************' puts ' * Movies Coming Soon *' puts ' * -------------- *' puts ' * Please wait! *' puts ' **********************' puts '' @movies = ComingSoon::Movie.movies @movies.each.with_index(1) do |movie, i| puts "#{i}. #{movie.name} - #{movie.start_date}" end end def list_saved_movies puts '' puts ' **********************' puts ' * Movies Coming Soon *' puts ' **********************' puts '' @movies.each.with_index(1) do |movie, i| puts "#{i}. #{movie.name} - #{movie.start_date}" end end def menu_selection input = '' while input != 'exit' puts '' puts 'You may enter a movie number for more details or "list" to see the menu again or "exit"' input = gets.strip if input.to_i > 0 && input.to_i < @movies.size+1 puts "* #{@movies[input.to_i - 1].name} - #{@movies[input.to_i - 1].start_date} *" puts @movies[input.to_i - 1].synopsis elsif input == 'list' list_saved_movies elsif input == 'exit' goodbye else puts 'Invalid selection!' menu_selection end end end def goodbye puts '' puts ' *************************' puts ' * Thank you and goodbye *' puts ' * ----------------- *' puts ' * Come back soon! *' puts ' *************************' puts '' exit end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
coming_soon-0.2.4 | lib/coming_soon/cli.rb |
coming_soon-0.2.3 | lib/coming_soon/cli.rb |