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

Version Path
kicks-3.1.1 examples/metrics_worker.rb
kicks-3.1.0 examples/metrics_worker.rb
kicks-3.0.0 examples/metrics_worker.rb
kicks-3.0.0.pre examples/metrics_worker.rb
sneakers-2.12.0 examples/metrics_worker.rb
sneakers-2.12.0.rc1 examples/metrics_worker.rb
sneakers-2.11.0 examples/metrics_worker.rb
sneakers-2.7.0 examples/metrics_worker.rb
sneakers-2.6.0 examples/metrics_worker.rb
sneakers-2.5.0 examples/metrics_worker.rb
sneakers-2.4.0 examples/metrics_worker.rb