Method: Grubby::JsonScraper.scrape_file

Defined in:
lib/grubby/json_scraper.rb

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

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

Examples:

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

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

Parameters:

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

Returns:

Raises:



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

def self.scrape_file(path, agent = $grubby)
  self.new(Grubby::JsonParser.read_local(path).tap{|parser| parser.mech = agent })
end