Class: RtTop100::Movie
- Inherits:
-
Object
- Object
- RtTop100::Movie
- Defined in:
- lib/rt_top_100/movie.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#audience_score ⇒ Object
Returns the value of attribute audience_score.
-
#critic_consensus ⇒ Object
Returns the value of attribute critic_consensus.
-
#director ⇒ Object
Returns the value of attribute director.
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#movie_url ⇒ Object
Returns the value of attribute movie_url.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#release_date ⇒ Object
Returns the value of attribute release_date.
-
#synopsis ⇒ Object
Returns the value of attribute synopsis.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tomatometer_score ⇒ Object
Returns the value of attribute tomatometer_score.
Class Method Summary collapse
Instance Method Summary collapse
- #add_details(details_hash) ⇒ Object
-
#initialize(movies_hash) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(movies_hash) ⇒ Movie
Returns a new instance of Movie.
7 8 9 10 11 12 |
# File 'lib/rt_top_100/movie.rb', line 7 def initialize(movies_hash) movies_hash.each do | attr, value | self.send("#{attr}=", value) end @@all << self end |
Instance Attribute Details
#audience_score ⇒ Object
Returns the value of attribute audience_score.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def audience_score @audience_score end |
#critic_consensus ⇒ Object
Returns the value of attribute critic_consensus.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def critic_consensus @critic_consensus end |
#director ⇒ Object
Returns the value of attribute director.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def director @director end |
#genre ⇒ Object
Returns the value of attribute genre.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def genre @genre end |
#movie_url ⇒ Object
Returns the value of attribute movie_url.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def movie_url @movie_url end |
#rating ⇒ Object
Returns the value of attribute rating.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def @rating end |
#release_date ⇒ Object
Returns the value of attribute release_date.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def release_date @release_date end |
#synopsis ⇒ Object
Returns the value of attribute synopsis.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def synopsis @synopsis end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def title @title end |
#tomatometer_score ⇒ Object
Returns the value of attribute tomatometer_score.
3 4 5 |
# File 'lib/rt_top_100/movie.rb', line 3 def tomatometer_score @tomatometer_score end |
Class Method Details
.all ⇒ Object
21 22 23 |
# File 'lib/rt_top_100/movie.rb', line 21 def self.all @@all end |
.movies_release_after(year) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/rt_top_100/movie.rb', line 25 def self.movies_release_after(year) released_movies = @@all.each.with_index do | movie, rank | if movie.title[-5..-2].to_i >= year puts "#{rank+1}. #{movie.title}" end end released_movies end |
Instance Method Details
#add_details(details_hash) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/rt_top_100/movie.rb', line 14 def add_details(details_hash) details_hash.each do | attr, value | self.send("#{attr}=", value) end self end |