Class: DustinAndersonCLIApp::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/CLI_class.rb

Constant Summary collapse

OPTIONS =
"Here are your options for lists: \n" "To see the top 10 enter: 'top 10'\n" "To see the top 25 enter: 'top 25'\n" "To see the top 50 enter: 'top 50'\n" "To see the full list enter: 'list'\n" "To see a random movie summary from the list enter 'random'\n" "To leave the program enter 'exit'\n\n"
SUMMARY_REMINDER =
"\nIf you would like to see a movie summary, enter 'movie summary' and then the rank of the movie you would like the summary of.\n\n"
WELCOME =
"Welcome to Rotten Tomatoes top 100 movies! This will list the rank, title, rating, and the number of reviews on Rotten Tomatoes. Once you choose how many movies to see at once, just input the rank of the movie to see the movie summary. At any time you can type 'exit' to quit the program, or options for a list of options. Each list will put the film rank, title, Rotten Tomato ranking, and the number of reviews.\n\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#movieObject

Returns the value of attribute movie.



6
7
8
# File 'lib/CLI_class.rb', line 6

def movie
  @movie
end

#movie_scraperObject

Returns the value of attribute movie_scraper.



6
7
8
# File 'lib/CLI_class.rb', line 6

def movie_scraper
  @movie_scraper
end

Instance Method Details

#callObject



14
15
16
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
44
45
46
47
48
49
# File 'lib/CLI_class.rb', line 14

def call

  puts WELCOME
  puts OPTIONS
  input = ""
  scrape = MovieScraper.new
  scrape.new_with_attributes
  while input.downcase != 'exit'
    input = gets.strip!
    if input.downcase == 'top 10'
      DustinAndersonCLIApp::Movie.top_ten
      puts SUMMARY_REMINDER
      puts OPTIONS
    elsif input.downcase == 'top 25'
      DustinAndersonCLIApp::Movie.top_twentyfive
      puts SUMMARY_REMINDER
      puts OPTIONS
    elsif input.downcase == 'top 50'
      DustinAndersonCLIApp::Movie.top_fifty
      puts SUMMARY_REMINDER
      puts OPTIONS
    elsif input.downcase == 'list'
      DustinAndersonCLIApp::Movie.list_all
      puts SUMMARY_REMINDER
      puts OPTIONS
    elsif input.downcase == 'options'
      puts OPTIONS
    elsif input.downcase == 'movie summary'
      DustinAndersonCLIApp::Movie.movie_summary #
    elsif input.downcase == 'random'
      DustinAndersonCLIApp::Movie.random_movie_summary
      puts "\n#{OPTIONS}"
    else puts OPTIONS
    end
  end
end