Class: MovieHelper::Movie

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#actorsObject

Returns the value of attribute actors.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def actors
  @actors
end

#directorObject

Returns the value of attribute director.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def director
  @director
end

#genreObject

Returns the value of attribute genre.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def genre
  @genre
end

#is_amazonObject

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_elsewhereObject

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_netflixObject

Returns the value of attribute is_netflix.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def is_netflix
  @is_netflix
end

#languageObject

Returns the value of attribute language.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def language
  @language
end

#moodObject

Returns the value of attribute mood.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def mood
  @mood
end

#summaryObject

Returns the value of attribute summary.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def title
  @title
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def url
  @url
end

#yearObject

Returns the value of attribute year.



2
3
4
# File 'lib/movie_helper/movie.rb', line 2

def year
  @year
end

Class Method Details

.allObject



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_amazonObject



25
26
27
# File 'lib/movie_helper/movie.rb', line 25

def self.latest_amazon
  @@all.select {|movie| movie.is_amazon == true}
end

.latest_elsewhereObject



29
30
31
# File 'lib/movie_helper/movie.rb', line 29

def self.latest_elsewhere
  @@all.select {|movie| movie.is_elsewhere == true}
end

.latest_netflixObject



21
22
23
# File 'lib/movie_helper/movie.rb', line 21

def self.latest_netflix
  @@all.select {|movie| movie.is_netflix == true}
end