class IMDB::Page::BasicPage
Public Class Methods
commit(io_path)
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 49 def self.commit io_path save_file.puts links File.readlines(io_path) end
end()
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 53 def self.end @@save_file.close end
links(lines)
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 39 def self.links lines lines.map do |line| line.scan(%r{href=".*?"}) end end
memoize_links(io_paths)
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 16 def self.memoize_links io_paths io_paths.each_with_index do |path, idx| self.commit(path) print "\b"*(idx.to_s.length) + idx.to_s + "/#{io_paths.count}" end self.end end
save_file()
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 45 def self.save_file @@save_file end
stub(stub_str)
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 12 def self.stub(stub_str) self.base_uri File.join self.base_uri, stub_str end
Public Instance Methods
noko()
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 35 def noko Nokogiri::HTML.parse target end
target(raw_html)
click to toggle source
# File lib/imdb-html/page/basic_page.rb, line 29 def target raw_html raw_html[ DIV_ID_PAGECONTENT ][ DIV_ID_FOOTER ] .sub(BILLBOARD, "") .gsub(BR, "") end