Class: MovieHelper::Movie
- Inherits:
-
Object
- Object
- MovieHelper::Movie
- Defined in:
- lib/movie_helper/movie.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#actors ⇒ Object
Returns the value of attribute actors.
-
#director ⇒ Object
Returns the value of attribute director.
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#is_amazon ⇒ Object
Returns the value of attribute is_amazon.
-
#is_elsewhere ⇒ Object
Returns the value of attribute is_elsewhere.
-
#is_netflix ⇒ Object
Returns the value of attribute is_netflix.
-
#language ⇒ Object
Returns the value of attribute language.
-
#mood ⇒ Object
Returns the value of attribute mood.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
-
#year ⇒ Object
Returns the value of attribute year.
Class Method Summary collapse
- .all ⇒ Object
- .create_from_list(movies) ⇒ Object
- .latest_amazon ⇒ Object
- .latest_elsewhere ⇒ Object
- .latest_netflix ⇒ Object
Instance Method Summary collapse
-
#initialize(movie_hash) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(movie_hash) ⇒ Movie
Returns a new instance of Movie.
6 7 8 9 |
# File 'lib/movie_helper/movie.rb', line 6 def initialize(movie_hash) movie_hash.each {|key, value| self.send(("#{key}="), value)} @@all << self end |
Instance Attribute Details
#actors ⇒ Object
Returns the value of attribute actors.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def actors @actors end |
#director ⇒ Object
Returns the value of attribute director.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def director @director end |
#genre ⇒ Object
Returns the value of attribute genre.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def genre @genre end |
#is_amazon ⇒ Object
Returns the value of attribute is_amazon.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def is_amazon @is_amazon end |
#is_elsewhere ⇒ Object
Returns the value of attribute is_elsewhere.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def is_elsewhere @is_elsewhere end |
#is_netflix ⇒ Object
Returns the value of attribute is_netflix.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def is_netflix @is_netflix end |
#language ⇒ Object
Returns the value of attribute language.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def language @language end |
#mood ⇒ Object
Returns the value of attribute mood.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def mood @mood end |
#summary ⇒ Object
Returns the value of attribute summary.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def summary @summary end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def url @url end |
#year ⇒ Object
Returns the value of attribute year.
2 3 4 |
# File 'lib/movie_helper/movie.rb', line 2 def year @year end |
Class Method Details
.all ⇒ Object
17 18 19 |
# File 'lib/movie_helper/movie.rb', line 17 def self.all @@all end |
.create_from_list(movies) ⇒ Object
11 12 13 14 15 |
# File 'lib/movie_helper/movie.rb', line 11 def self.create_from_list(movies) movies.each do |movie| film = MovieHelper::Movie.new(movie) end end |
.latest_amazon ⇒ Object
25 26 27 |
# File 'lib/movie_helper/movie.rb', line 25 def self.latest_amazon @@all.select {|movie| movie.is_amazon == true} end |
.latest_elsewhere ⇒ Object
29 30 31 |
# File 'lib/movie_helper/movie.rb', line 29 def self.latest_elsewhere @@all.select {|movie| movie.is_elsewhere == true} end |
.latest_netflix ⇒ Object
21 22 23 |
# File 'lib/movie_helper/movie.rb', line 21 def self.latest_netflix @@all.select {|movie| movie.is_netflix == true} end |