Module: Scraper

Defined in:
lib/scraper/base.rb,
lib/scraper/reader.rb,
lib/scraper/microformats.rb

Class Method Summary collapse

Class Method Details

.define(&block) ⇒ Object

Define an anonymous scraper and returns the class.

For example:

links = Scraper.define do
   process "a[href]", :urls=>"@href"
   result :urls
end

puts links.scrape(html)


984
985
986
987
988
# File 'lib/scraper/base.rb', line 984

def self.define(&block)
  kls = Class.new(Scraper::Base)
  kls.module_eval &block
  return kls
end