class BestMoviesEver::Movie
Attributes
audience_score[RW]
critics_consensus[RW]
rank[RW]
rating[RW]
synopsis[RW]
title[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/best_movies_ever/movie.rb, line 21 def self.all @@all end
create_from_collection(movies_array)
click to toggle source
# File lib/best_movies_ever/movie.rb, line 11 def self.create_from_collection(movies_array) movies_array.map{|movie_hash| self.new(movie_hash)} end
find(rank)
click to toggle source
# File lib/best_movies_ever/movie.rb, line 25 def self.find(rank) @@all[rank - 1] end
new(movie_hash)
click to toggle source
# File lib/best_movies_ever/movie.rb, line 6 def initialize(movie_hash) movie_hash.each{|attribute, value| self.send("#{attribute}=", value)} @@all << self end
Public Instance Methods
add_movie_attributes(attributes_hash)
click to toggle source
add additonal movie attributes such as critics consensus, audience score, synopsis
# File lib/best_movies_ever/movie.rb, line 16 def add_movie_attributes(attributes_hash) attributes_hash.each{|attribute, value| self.send("#{attribute}=", value)} self end