Document known crystal overrides

This commit is contained in:
Samantaz Fox 2021-08-01 22:24:19 +02:00
parent 6bdcd9e96c
commit dfd660ca72
No known key found for this signature in database
GPG Key ID: F42821059186176E

View File

@ -1,3 +1,7 @@
# Override of the TCPSocket and HTTP::Client classes in oder to allow an
# IP family to be selected for domains that resolve to both IPv4 and
# IPv6 addresses.
#
class TCPSocket
def initialize(host, port, dns_timeout = nil, connect_timeout = nil, family = Socket::Family::UNSPEC)
Addrinfo.tcp(host, port, timeout: dns_timeout, family: family) do |addrinfo|
@ -10,6 +14,7 @@ class TCPSocket
end
end
# :ditto:
class HTTP::Client
property family : Socket::Family = Socket::Family::UNSPEC
@ -32,6 +37,9 @@ class HTTP::Client
end
end
# Mute the ClientError exception raised when a connection is flushed.
# This happends when the connection is unexpectedly closed by the client.
#
class HTTP::Server::Response
class Output
private def unbuffered_flush
@ -42,6 +50,8 @@ class HTTP::Server::Response
end
end
# TODO: Document this override
#
class PG::ResultSet
def field(index = @column_index)
@fields.not_nil![index]