Sha256: 2d4929075ac379452a23dc7ae3c9523cae5f23ef036ed78bf92e3083b7b5b0fe

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

class MovieHelper::Movie
  attr_accessor :title, :year, :summary, :genre, :mood, :actors, :director, :language, :language, :url, :is_netflix, :is_amazon, :is_elsewhere

  @@all = []

  def initialize(movie_hash)
    movie_hash.each {|key, value| self.send(("#{key}="), value)}
    @@all << self
  end

  def self.create_from_list(movies)
    movies.each do |movie|
      film = MovieHelper::Movie.new(movie)
    end
  end

  def self.all
    @@all
  end

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

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

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


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
movie_helper-0.2.0 lib/movie_helper/movie.rb