Class: Async::HTTP::WebMockEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/webmock/http_lib_adapters/async_http_client_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme, authority, protocol) ⇒ WebMockEndpoint

Returns a new instance of WebMockEndpoint.



133
134
135
136
137
# File 'lib/webmock/http_lib_adapters/async_http_client_adapter.rb', line 133

def initialize(scheme, authority, protocol)
  @scheme = scheme
  @authority = authority
  @protocol = protocol
end

Instance Attribute Details

#authorityObject (readonly)

Returns the value of attribute authority.



139
140
141
# File 'lib/webmock/http_lib_adapters/async_http_client_adapter.rb', line 139

def authority
  @authority
end

#protocolObject (readonly)

Returns the value of attribute protocol.



139
140
141
# File 'lib/webmock/http_lib_adapters/async_http_client_adapter.rb', line 139

def protocol
  @protocol
end

#schemeObject (readonly)

Returns the value of attribute scheme.



139
140
141
# File 'lib/webmock/http_lib_adapters/async_http_client_adapter.rb', line 139

def scheme
  @scheme
end

Instance Method Details

#connectObject



141
142
143
144
145
146
147
# File 'lib/webmock/http_lib_adapters/async_http_client_adapter.rb', line 141

def connect
  server_socket, client_socket = create_connected_sockets
  Async(transient: true) do
    accept_socket(server_socket)
  end
  client_socket
end

#inspectObject



149
150
151
# File 'lib/webmock/http_lib_adapters/async_http_client_adapter.rb', line 149

def inspect
  "\#<#{self.class}> #{scheme}://#{authority} protocol=#{protocol}"
end