Sha256: a5b080ed76e881274e44b4963b376cd2624290b9bdd56ab7a1457213ef1cf22c
Contents?: true
Size: 560 Bytes
Versions: 11
Compression:
Stored size: 560 Bytes
Contents
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' require 'sneakers/metrics/logging_metrics' require 'open-uri' class MetricsWorker include Sneakers::Worker from_queue 'downloads' def work(msg) title = extract_title(open(msg)) logger.info "FOUND <#{title}>" ack! end private def extract_title(html) html =~ /<title>(.*?)<\/title>/ $1 end end Sneakers.configure(:metrics => Sneakers::Metrics::LoggingMetrics.new) r = Sneakers::Runner.new([ MetricsWorker ]) r.run
Version data entries
11 entries across 11 versions & 2 rubygems