Class: Net::HTTP::Pool

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/net/http/pool.rb

Overview

Public: The Pool itself

host - The string of the host.

Defined Under Namespace

Classes: Connections

Instance Method Summary collapse

Constructor Details

#initialize(host, options = {}) ⇒ Pool

Returns a new instance of Pool.



47
48
49
50
# File 'lib/net/http/pool.rb', line 47

def initialize(host, options = {})
  @pool = Connections.new(host, options)
  @uri = URI(host)
end

Instance Method Details

#async_request(request, &block) ⇒ Object

Raises:

  • (LocalJumpError)


56
57
58
59
60
61
62
# File 'lib/net/http/pool.rb', line 56

def async_request(request, &block)
  raise LocalJumpError unless block

  @pool.with do |connection|
    yield connection.request(@uri, request)
  end
end

#request(request, &block) ⇒ Object



52
53
54
# File 'lib/net/http/pool.rb', line 52

def request(request, &block)
  async_request!(request, &block)
end