Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require 'scrubyt' class DeliTagScrapingWorker < BackgrounDRb::MetaWorker set_worker_name :deli_tag_scraping_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def get_links(parameterhash) tag = parameterhash["tag"] logger.info "###### tag variable = " + tag delicious_resource = 'http://del.icio.us/tag/' + tag begin scrap_delicio_resource(delicious_resource,parameterhash["id"]) rescue Timeout::Error puts "Timeout Error" rescue puts "#{$!.message}" end end def scrap_delicio_resource p_url,pid Scrubyt::Extractor.define do fetch p_url item '/html/body/div/ol/li/h4/a' do url 'href', :type => :attribute current_link = Link.new current_link.linkhash = "klappt" current_link.url = url.to_string current_link.source_id = pid # reference links to source that was created in the boxes controller current_link.save end next_page "« earlier", :limit => 5 end end end
This paste will be private.
From the Design Piracy series on my blog: