Class: NewMovies::Movie
- Inherits:
-
Object
- Object
- NewMovies::Movie
- Defined in:
- lib/new_movies/movie.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#cast ⇒ Object
Returns the value of attribute cast.
-
#director ⇒ Object
Returns the value of attribute director.
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#index ⇒ Object
Returns the value of attribute index.
-
#movie_site ⇒ Object
Returns the value of attribute movie_site.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#release_date ⇒ Object
Returns the value of attribute release_date.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#synopsis ⇒ Object
Returns the value of attribute synopsis.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #attribute_assignment(movies_hash_attributes) ⇒ Object
-
#initialize(movie_list_hash) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(movie_list_hash) ⇒ Movie
Returns a new instance of Movie.
7 8 9 10 |
# File 'lib/new_movies/movie.rb', line 7 def initialize(movie_list_hash) movie_list_hash.each{|key, value| self.send(("#{key}="), value)} @@all << self end |
Instance Attribute Details
#cast ⇒ Object
Returns the value of attribute cast.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def cast @cast end |
#director ⇒ Object
Returns the value of attribute director.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def director @director end |
#genre ⇒ Object
Returns the value of attribute genre.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def genre @genre end |
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def index @index end |
#movie_site ⇒ Object
Returns the value of attribute movie_site.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def movie_site @movie_site end |
#rating ⇒ Object
Returns the value of attribute rating.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def end |
#release_date ⇒ Object
Returns the value of attribute release_date.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def release_date @release_date end |
#runtime ⇒ Object
Returns the value of attribute runtime.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def runtime @runtime end |
#synopsis ⇒ Object
Returns the value of attribute synopsis.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def synopsis @synopsis end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/new_movies/movie.rb', line 3 def url @url end |
Class Method Details
.all ⇒ Object
23 24 25 |
# File 'lib/new_movies/movie.rb', line 23 def self.all @@all end |
.create_movie_list(movie_array) ⇒ Object
17 18 19 20 21 |
# File 'lib/new_movies/movie.rb', line 17 def self.create_movie_list(movie_array) movie_array.each do |movie| NewMovies::Movie.new(movie) end end |
.find_movie_by_index(index) ⇒ Object
27 28 29 30 |
# File 'lib/new_movies/movie.rb', line 27 def self.find_movie_by_index(index) NewMovies::Movie.all[index.to_i - 1].attribute_assignment(NewMovies::Scraper.scrape_movie_details(NewMovies::Movie.all[index.to_i - 1])) NewMovies::Movie.all[index.to_i - 1] end |
Instance Method Details
#attribute_assignment(movies_hash_attributes) ⇒ Object
12 13 14 15 |
# File 'lib/new_movies/movie.rb', line 12 def attribute_assignment(movies_hash_attributes) #binding.pry movies_hash_attributes.each{|key, value| self.send(("#{key}="), value)} end |