Class: TopMoviesOf::Movie
- Inherits:
-
Object
- Object
- TopMoviesOf::Movie
- Defined in:
- lib/Top_Movies_Of/movie.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#ranking ⇒ Object
Returns the value of attribute ranking.
-
#score ⇒ Object
Returns the value of attribute score.
-
#summary ⇒ Object
Returns the value of attribute summary.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ranking = nil, name = nil, score = nil, summary = nil) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(ranking = nil, name = nil, score = nil, summary = nil) ⇒ Movie
Returns a new instance of Movie.
7 8 9 10 11 12 13 |
# File 'lib/Top_Movies_Of/movie.rb', line 7 def initialize(ranking = nil, name = nil, score = nil, summary = nil) @ranking = ranking @name = name @score = score @summary = summary @@all <<self end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/Top_Movies_Of/movie.rb', line 5 def name @name end |
#ranking ⇒ Object
Returns the value of attribute ranking.
5 6 7 |
# File 'lib/Top_Movies_Of/movie.rb', line 5 def ranking @ranking end |
#score ⇒ Object
Returns the value of attribute score.
5 6 7 |
# File 'lib/Top_Movies_Of/movie.rb', line 5 def score @score end |
#summary ⇒ Object
Returns the value of attribute summary.
5 6 7 |
# File 'lib/Top_Movies_Of/movie.rb', line 5 def summary @summary end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/Top_Movies_Of/movie.rb', line 15 def self.all @@all end |
.find_movie(input) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/Top_Movies_Of/movie.rb', line 19 def self.find_movie(input) self.all.each do |movie| if movie.ranking == input @name = movie.name return movie end end end |