class IMDB::Data::Show

Public Class Methods

new(tt) click to toggle source
# File lib/imdb-html/data/show.rb, line 8
def initialize tt
        @tt = tt.to_i
end
process(tt) click to toggle source
# File lib/imdb-html/data/show.rb, line 34
def self.process tt
        show = Show.new tt
        File.open show.json_path, "w" do |j|
                j.puts JSON.pretty_generate( show.episodes )
        end
end

Public Instance Methods

episodes() click to toggle source
# File lib/imdb-html/data/show.rb, line 26
def episodes
        Episode.parse_params( noko "epcast" )
end
http(*args) click to toggle source
# File lib/imdb-html/data/show.rb, line 18
def http *args
        self.class.get path *args
end
json_path() click to toggle source
# File lib/imdb-html/data/show.rb, line 30
def json_path
        File.join "/home/mdt/g/imdb-memo/json/#{tt}.json"
end
noko(*args) click to toggle source
# File lib/imdb-html/data/show.rb, line 21
def noko *args
        Nokogiri::HTML http *args
end
path(*args) click to toggle source
# File lib/imdb-html/data/show.rb, line 15
def path *args
        File.join *["/title/tt#{tt}", args].flatten
end
tt() click to toggle source
# File lib/imdb-html/data/show.rb, line 12
def tt
        @tt.to_s.rjust 7, '0'
end