Sha256: 651fe5a858be3f2e80f51d85ba35b7a033e23795be1dd96fb345f7a7fd5f3975

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

class NewMovies::Movie
  attr_accessor :title, :url, :runtime, :genre, :release_date, :cast, :director, :movie_site, :synopsis, :rating, :index

  @@all = []

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

  def attribute_assignment(movies_hash_attributes)
    movies_hash_attributes.each{|key, value| self.send(("#{key}="), value)}
  end

  def self.create_movie_list(movie_array)
    movie_array.each do |movie|
      NewMovies::Movie.new(movie)
    end
  end

  def self.all
    @@all
  end

  def self.find_movie_by_index(index)
    NewMovies::Movie.all[index.to_i - 1].attribute_assignment(NewMovies::Scraper.scrape_movie_details(NewMovies::Movie.all[index.to_i - 1]))
    NewMovies::Movie.all[index.to_i - 1]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
new_movies_cinemark-0.1.11 lib/new_movies/movie.rb
new_movies_cinemark-0.1.10 lib/new_movies/movie.rb