Sha256: 72307610756d175bbc333a0fba95953029be6e5bb2dc9eb256f8a475aba8f23e

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

class Top10BoxOffice::Movie
  attr_accessor :title, :url, :weekend_total, :gross, :weeks, :movie_details
  @@all = []
  @@date = nil

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

  def get_details
    movie_profile = Top10BoxOffice::MovieDetails.new(Top10BoxOffice::Scraper.new.get_movie_details(url))
    movie_profile.movie = self
    movie_profile
  end

  def self.find_or_get_details(idx)
    self.all[idx].movie_details ||= self.all[idx].get_details
  end

  def self.set_date(date)
    @@date = date
  end

  def self.date
    @@date
  end

  def self.all
    @@all
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
top_10_box_office-0.1.2 lib/top_10_box_office/movie.rb
top_10_box_office-0.1.1 lib/top_10_box_office/movie.rb
top_10_box_office-0.1.0 lib/top_10_box_office/movie.rb