Class: MovieGem::Movie
- Inherits:
-
Object
- Object
- MovieGem::Movie
- Defined in:
- lib/movie_gem/movie.rb
Instance Attribute Summary collapse
-
#synopsis ⇒ Object
Returns the value of attribute synopsis.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(attributes = {}) ⇒ Movie
Returns a new instance of Movie.
5 6 7 8 |
# File 'lib/movie_gem/movie.rb', line 5 def initialize(attributes = {}) @title = attributes[:title] @synopsis = attributes[:synopsis] end |
Instance Attribute Details
#synopsis ⇒ Object
Returns the value of attribute synopsis.
3 4 5 |
# File 'lib/movie_gem/movie.rb', line 3 def synopsis @synopsis end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/movie_gem/movie.rb', line 3 def title @title end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/movie_gem/movie.rb', line 9 def self.all @@all ||= self.load end |
.create_from_collection(movies_array) ⇒ Object
12 13 14 15 16 |
# File 'lib/movie_gem/movie.rb', line 12 def self.create_from_collection(movies_array) movies_array.collect do |movie_hash| Movie.new(movie_hash) end end |
.load ⇒ Object
17 18 19 |
# File 'lib/movie_gem/movie.rb', line 17 def self.load create_from_collection(MovieGem::Scraper.scrape_movies) end |