class DustinAndersonCLIApp::Movie
Constants
- OPTIONS
Attributes
genre[RW]
movie_scraper[RW]
parental[RW]
rank[RW]
rating[RW]
reviews[RW]
studio[RW]
summary[RW]
theatre_date[RW]
title[RW]
Public Class Methods
all()
click to toggle source
# File lib/dustin_anderson_cli_app.rb, line 22 def self.all @@all end
list_all()
click to toggle source
# 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.rating} #{film.reviews}" end end
movie_summary()
click to toggle source
# 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
new(rank = nil, title = nil, rating = nil, reviews = nil, summary = nil, parental = nil, genre = nil, theatre_date = nil, studio = nil)
click to toggle source
# File lib/dustin_anderson_cli_app.rb, line 9 def initialize(rank = nil, title = nil, rating = nil, reviews = nil, summary = nil, parental = nil, genre = nil, theatre_date = nil, studio = nil) @rank = rank @title = title @rating = rating @reviews = reviews @summary = summary @parental = parental @genre = genre @theatre_date = theatre_date @studio = studio @@all << self end
random_movie_summary()
click to toggle source
# 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()
click to toggle source
# 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.rating} #{film.reviews}" end end
top_ten()
click to toggle source
# 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.rating} #{film.reviews}" end end
top_twentyfive()
click to toggle source
# 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.rating} #{film.reviews}" end end