Class: TopMoviesOf::Movie

Inherits:
Object
  • Object
show all
Defined in:
lib/Top_Movies_Of/movie.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/Top_Movies_Of/movie.rb', line 5

def name
  @name
end

#rankingObject

Returns the value of attribute ranking.



5
6
7
# File 'lib/Top_Movies_Of/movie.rb', line 5

def ranking
  @ranking
end

#scoreObject

Returns the value of attribute score.



5
6
7
# File 'lib/Top_Movies_Of/movie.rb', line 5

def score
  @score
end

#summaryObject

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

.allObject



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