Sha256: 2eacdacb16ab59e9347e85846101b4484104099b28617eec903cd0eed11fcccb

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

class MovieHelper::Movie
  attr_accessor :title, :year, :watch_with, :watch_when, :genre, :review, :stars, :rating, :language, :url, :is_latest, :is_best

  @@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.best_films
    @@all.select {|movie| movie.is_best == true}
  end

  def self.latest
    @@all.select {|movie| movie.is_latest == true}
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

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