Class: ReactOnRailsPro::RendererHttpClient::ConnectTimeoutWrapper
- Inherits:
-
IO::Endpoint::Wrapper
- Object
- IO::Endpoint::Wrapper
- ReactOnRailsPro::RendererHttpClient::ConnectTimeoutWrapper
- Defined in:
- lib/react_on_rails_pro/renderer_http_client.rb
Overview
Uses only public, documented Wrapper APIs (connect with timeout:, set_timeout) that have been stable since io-endpoint 0.15. No version pin needed —async-http’s own constraint (~> 0.14) governs the version.
Instance Method Summary collapse
- #connect(remote_address, **options) ⇒ Object
-
#initialize(connect_timeout:, read_timeout: nil) ⇒ ConnectTimeoutWrapper
constructor
A new instance of ConnectTimeoutWrapper.
Constructor Details
#initialize(connect_timeout:, read_timeout: nil) ⇒ ConnectTimeoutWrapper
Returns a new instance of ConnectTimeoutWrapper.
60 61 62 63 64 |
# File 'lib/react_on_rails_pro/renderer_http_client.rb', line 60 def initialize(connect_timeout:, read_timeout: nil) super() @connect_timeout = connect_timeout @read_timeout = read_timeout end |
Instance Method Details
#connect(remote_address, **options) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/react_on_rails_pro/renderer_http_client.rb', line 66 def connect(remote_address, **) socket = super(remote_address, **.merge(@connect_timeout ? { timeout: @connect_timeout } : {})) set_timeout(socket, @read_timeout) return socket unless block_given? begin yield socket ensure socket.close end end |