Sha256: 86aa3bed5d1e39440a659050d7a0152b9fd06e774acae20b825588f4c45fcda7

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

require 'typhoeus/hydras/easy_factory'
require 'typhoeus/hydras/easy_pool'
require 'typhoeus/hydras/memoizable'
require 'typhoeus/hydras/queueable'
require 'typhoeus/hydras/runnable'

module Typhoeus

  # Hydra manages making parallel HTTP requests. This
  # is archived by using libcurls multi interface. The
  # benefits are that you don't have to worry running
  # the requests by yourself.
  class Hydra
    include Hydras::EasyPool
    include Hydras::Queueable
    include Hydras::Runnable
    include Hydras::Memoizable

    attr_reader :max_concurrency, :multi

    # Create a new hydra.
    #
    # @example Create a hydra.
    #   Typhoeus::Hydra.new
    #
    # @param [ Hash ] options The options hash.
    #
    # @option options :max_concurrency [ Integer ] Number
    #  of max concurrent connections to create. Default is
    #  200.
    def initialize(options = {})
      @options = options
      @max_concurrency = @options.fetch(:max_concurrency, 200)
      @multi = Ethon::Multi.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typhoeus-0.5.0.pre lib/typhoeus/hydra.rb