Sha256: 191afd7b3fa398bfb8a01a58410ecb83e39a71371483dcbb557cae377ba28283

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

require 'open-uri'
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)
    #binding.pry
    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

3 entries across 3 versions & 2 rubygems

Version Path
new_movies_cinemark-0.1.2 lib/new_movies/movie.rb
new_movies_cinemark-0.1.1 lib/new_movies/movie.rb
new_movies-0.1.0 lib/new_movies/movie.rb