Class: Net::HTTP::Pool
- Inherits:
-
Object
- Object
- Net::HTTP::Pool
- 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
- #async_request(request, &block) ⇒ Object
-
#initialize(host, options = {}) ⇒ Pool
constructor
A new instance of Pool.
- #request(request, &block) ⇒ Object
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, = {}) @pool = Connections.new(host, ) @uri = URI(host) end |
Instance Method Details
#async_request(request, &block) ⇒ Object
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 |