Sha256: 87cf8bda2f12bc411a705ac207fd54a5f2c051eb9b1c46c395ca07d0ec52fe73
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 Bytes
Contents
require "hwacha/version" require "typhoeus" class Hwacha def initialize(max_concurrent_requests=20) @max_concurrent_requests = max_concurrent_requests end def check(urls) hydra = Typhoeus::Hydra.new(:max_concurrency => @max_concurrent_requests) Array(urls).each do |url| request = Typhoeus::Request.new(url) request.on_complete do |response| yield response.effective_url, response end hydra.queue request end hydra.run end def find_existing(urls) check(urls) do |url, response| yield url if response.success? end end # Hwacha!!! alias :fire :check alias :strike_true :find_existing end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hwacha-0.1.0 | lib/hwacha.rb |