Class: Myimdb::Scraper::Base

Inherits:
Object
  • Object
show all
Includes:
HandleExceptions, StringExtensions
Defined in:
lib/myimdb/scraper/base.rb

Direct Known Subclasses

Freebase, Imdb, Metacritic, RottenTomatoes

Constant Summary

Constants included from HandleExceptions

HandleExceptions::EXCEPTIONS_ENABLED

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StringExtensions

#scraper_unescape_html, #strip_useless_chars

Methods included from HandleExceptions

included

Class Method Details

.allObject



71
72
73
# File 'lib/myimdb/scraper/base.rb', line 71

def self.all
  ['Freebase', 'Metacritic', 'RottenTomatoes', 'Imdb']
end

Instance Method Details

#directorsObject



42
# File 'lib/myimdb/scraper/base.rb', line 42

def directors; end

#directors_with_urlObject



43
# File 'lib/myimdb/scraper/base.rb', line 43

def directors_with_url; end

#genresObject



48
# File 'lib/myimdb/scraper/base.rb', line 48

def genres; end

#imageObject



53
# File 'lib/myimdb/scraper/base.rb', line 53

def image; end

#nameObject



41
# File 'lib/myimdb/scraper/base.rb', line 41

def name; end

#plotObject



50
# File 'lib/myimdb/scraper/base.rb', line 50

def plot; end

#ratingObject



46
# File 'lib/myimdb/scraper/base.rb', line 46

def rating; end

#release_dateObject



52
# File 'lib/myimdb/scraper/base.rb', line 52

def release_date; end

#summaryObject



55
56
57
58
59
60
61
# File 'lib/myimdb/scraper/base.rb', line 55

def summary
  [:directors, :writers, :rating, :votes, :genres, :tagline, :plot, :year, :release_date].collect do |meth|
    data = send(meth)
    data = data.join(", ") if Array === data
    sprintf("%-15s : %s", meth.to_s.capitalize, data)
  end.join("\n")
end

#taglineObject



49
# File 'lib/myimdb/scraper/base.rb', line 49

def tagline; end

#to_hashObject



63
64
65
66
67
68
69
# File 'lib/myimdb/scraper/base.rb', line 63

def to_hash
  movie_as_hash = {}
  [:directors, :writers, :rating, :votes, :genres, :tagline, :plot, :year, :release_date].each do |meth|
    movie_as_hash[meth] = send(meth)
  end
  movie_as_hash
end

#votesObject



47
# File 'lib/myimdb/scraper/base.rb', line 47

def votes; end

#writersObject



44
# File 'lib/myimdb/scraper/base.rb', line 44

def writers; end

#writers_with_urlObject



45
# File 'lib/myimdb/scraper/base.rb', line 45

def writers_with_url; end

#yearObject



51
# File 'lib/myimdb/scraper/base.rb', line 51

def year; end