Class: DustinAndersonCLIApp::Movie
- Inherits:
-
Object
- Object
- DustinAndersonCLIApp::Movie
- Defined in:
- lib/dustin_anderson_cli_app.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"
- @@all =
[]
Instance Attribute Summary collapse
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#movie_scraper ⇒ Object
Returns the value of attribute movie_scraper.
-
#parental ⇒ Object
Returns the value of attribute parental.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#reviews ⇒ Object
Returns the value of attribute reviews.
-
#studio ⇒ Object
Returns the value of attribute studio.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#theatre_date ⇒ Object
Returns the value of attribute theatre_date.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
- .all ⇒ Object
- .list_all ⇒ Object
- .movie_summary ⇒ Object
- .random_movie_summary ⇒ Object
- .top_fifty ⇒ Object
- .top_ten ⇒ Object
- .top_twentyfive ⇒ Object
Instance Method Summary collapse
-
#initialize(rank = nil, title = nil, rating = nil, reviews = nil, summary = nil, parental = nil, genre = nil, theatre_date = nil, studio = nil) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(rank = nil, title = nil, rating = nil, reviews = nil, summary = nil, parental = nil, genre = nil, theatre_date = nil, studio = nil) ⇒ Movie
Returns a new instance of Movie.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dustin_anderson_cli_app.rb', line 9 def initialize(rank = nil, title = nil, = nil, reviews = nil, summary = nil, parental = nil, genre = nil, theatre_date = nil, studio = nil) @rank = rank @title = title @rating = @reviews = reviews @summary = summary @parental = parental @genre = genre @theatre_date = theatre_date @studio = studio @@all << self end |
Instance Attribute Details
#genre ⇒ Object
Returns the value of attribute genre.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def genre @genre end |
#movie_scraper ⇒ Object
Returns the value of attribute movie_scraper.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def movie_scraper @movie_scraper end |
#parental ⇒ Object
Returns the value of attribute parental.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def parental @parental end |
#rank ⇒ Object
Returns the value of attribute rank.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def rank @rank end |
#rating ⇒ Object
Returns the value of attribute rating.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def @rating end |
#reviews ⇒ Object
Returns the value of attribute reviews.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def reviews @reviews end |
#studio ⇒ Object
Returns the value of attribute studio.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def studio @studio end |
#summary ⇒ Object
Returns the value of attribute summary.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def summary @summary end |
#theatre_date ⇒ Object
Returns the value of attribute theatre_date.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def theatre_date @theatre_date end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/dustin_anderson_cli_app.rb', line 5 def title @title end |
Class Method Details
.all ⇒ Object
22 23 24 |
# File 'lib/dustin_anderson_cli_app.rb', line 22 def self.all @@all end |
.list_all ⇒ Object
44 45 46 47 48 |
# File 'lib/dustin_anderson_cli_app.rb', line 44 def self.list_all DustinAndersonCLIApp::Movie.all[0..99].each do |film| puts "#{film.rank}. #{film.title} #{film.} #{film.reviews}" end end |
.movie_summary ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/dustin_anderson_cli_app.rb', line 50 def self.movie_summary another_summary = "" while another_summary != 'options' if another_summary == 'exit' break end puts "Please enter the rank of the move you would like the summary of: " summary_input = gets.strip! if summary_input == 'exit' break end if summary_input.to_i >= 1 && summary_input.to_i <= 100 self.all.each do |film| if film.rank == summary_input puts "#{film.title}:" puts film.summary puts "\nIf you would like a few more details about the movie enter 'more'.If you want another movie summary enter 'yes' or press the enter key. Else type 'options' for list of options." another_summary = gets.downcase.strip! if another_summary == 'more' puts "#{film.title}: " puts " Parental Rating: #{film.parental}\n Film Genre: #{film.genre}\n In Theatres: #{film.theatre_date}\n Studio: #{film.studio}\n" puts "\nIf you want another movie summary enter 'yes' or press the enter key. Else type 'options' for list of options." another_summary = gets.downcase.strip! elsif another_summary == 'options' || another_summary == "" break end end end end end puts "\n#{OPTIONS}" end |
.random_movie_summary ⇒ Object
83 84 85 86 87 |
# File 'lib/dustin_anderson_cli_app.rb', line 83 def self.random_movie_summary random_movie_summary = self.all.sample puts "#{random_movie_summary.title} #{random_movie_summary.rank}: " puts "#{random_movie_summary.summary}\n" end |
.top_fifty ⇒ Object
38 39 40 41 42 |
# File 'lib/dustin_anderson_cli_app.rb', line 38 def self.top_fifty DustinAndersonCLIApp::Movie.all[0..49].each do |film| puts "#{film.rank}. #{film.title} #{film.} #{film.reviews}" end end |
.top_ten ⇒ Object
26 27 28 29 30 |
# File 'lib/dustin_anderson_cli_app.rb', line 26 def self.top_ten DustinAndersonCLIApp::Movie.all[0..9].each do |film| puts "#{film.rank}. #{film.title} #{film.} #{film.reviews}" end end |
.top_twentyfive ⇒ Object
32 33 34 35 36 |
# File 'lib/dustin_anderson_cli_app.rb', line 32 def self.top_twentyfive DustinAndersonCLIApp::Movie.all[0..24].each do |film| puts "#{film.rank}. #{film.title} #{film.} #{film.reviews}" end end |