Method: Grubby::PageScraper.scrape_file

Defined in:
lib/grubby/page_scraper.rb

.scrape_file(path, agent = $grubby) ⇒ Grubby::PageScraper

Scrapes a locally-stored file. This method is intended for use with subclasses of Grubby::PageScraper.

Examples:

class MyScraper < Grubby::PageScraper
  # ...
end

MyScraper.scrape_file("path/to/local_file.html")  # === MyScraper

Parameters:

  • path (String)
  • agent (Mechanize) (defaults to: $grubby)

Returns:

Raises:



31
32
33
# File 'lib/grubby/page_scraper.rb', line 31

def self.scrape_file(path, agent = $grubby)
  self.new(Mechanize::Page.read_local(path).tap{|page| page.mech = agent })
end