class Top100Movies::Movie
Attributes
box_office[RW]
directors[RW]
disc_release_date[RW]
genres[RW]
name[RW]
rank[RW]
rating[RW]
release_date[RW]
runtime[RW]
score[RW]
studio[RW]
synopsis[RW]
url[RW]
writers[RW]
Public Class Methods
all()
click to toggle source
# File lib/top_100_movies/movie.rb, line 27 def self.all @@all.reject { |c| c.name.empty? } end
find(rank)
click to toggle source
# File lib/top_100_movies/movie.rb, line 31 def self.find(rank) if @@all[rank-1].synopsis == nil Top100Movies::Scraper.scrape_details(@@all[rank-1]) @@all[rank-1] else @@all[rank-1] end end
new(rank=nil, name=nil, score=nil, url=nil)
click to toggle source
# File lib/top_100_movies/movie.rb, line 7 def initialize(rank=nil, name=nil, score=nil, url=nil) @rank = rank @name = name @score = score @url = url @disc_release_date = "N/A" @box_office = "N/A" @writers = "N/A" @@all << self end
new_from_index(index)
click to toggle source
# File lib/top_100_movies/movie.rb, line 18 def self.new_from_index(index) self.new( index.search(".bold").text.tr('\.',''), index.search(".unstyled").text.strip, index.search(".tMeterScore").text.strip, Top100Movies::Scraper.scrape_url(index) ) end
print_movie(movie)
click to toggle source
# File lib/top_100_movies/movie.rb, line 40 def self.print_movie(movie) puts "" puts "#{movie.rank}. #{movie.name}" puts "" puts "Rotten Tomatoes Score: #{movie.score}" puts "" puts "Synopsis" puts "#{movie.synopsis}" puts "" printf "%18s %-2s \n", "Rating:", movie.rating printf "%18s %-2s \n", "Genre:", movie.genres.join(", ") printf "%18s %-2s \n", "Directors:", movie.directors printf "%18s %-2s \n", "Writers:", movie.writers printf "%18s %-2s \n", "In Theaters:", movie.release_date[0..11] printf "%18s %-2s \n", "On Disc/Streaming:", movie.disc_release_date printf "%18s %-2s \n", "Box Office:", movie.box_office printf "%18s %-2s \n", "Runtime:", movie.runtime printf "%18s %-2s \n", "Studio:", movie.studio end