creates a UNIX socket server on path. It calls the block for each socket accepted.
If host is specified, it is used with port to determine the server ports.
The socket is not closed when the block returns. So application should close it.
This method deletes the socket file pointed by path at first if the file is a socket file and it is owned by the user of the application. This is safe only if the directory of path is not changed by a malicious user. So don’t use /tmp/malicious-users-directory/socket. Note that /tmp/socket and /tmp/your-private-directory/socket is safe assuming that /tmp has sticky bit.
# Sequential echo server. # It services only one client at a time. Socket.unix_server_loop("/tmp/sock") {|sock, client_addrinfo| begin IO.copy_stream(sock, sock) ensure sock.close end }
Unpacks sockaddr into port and ip_address.
sockaddr should be a string or an addrinfo for AF_INET/AF_INET6.
sockaddr = Socket.sockaddr_in(80, "127.0.0.1") p sockaddr #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" p Socket.unpack_sockaddr_in(sockaddr) #=> [80, "127.0.0.1"]
Packs path as an AF_UNIX sockaddr string.
Socket.sockaddr_un("/tmp/sock") #=> "\x01\x00/tmp/sock\x00\x00..."
Returns true for IPv6 unique local address (fc00::/7, RFC4193). It returns false otherwise.
Makes hsh compare its keys by their identity, i.e. it will consider exact same objects as same keys.
h1 = { "a" => 100, "b" => 200, :c => "c" } h1["a"] #=> 100 h1.compare_by_identity h1.compare_by_identity? #=> true h1["a".dup] #=> nil # different objects. h1[:c] #=> "c" # same symbols are all same.
Returns true
if hsh will compare its keys by their identity. Also see Hash#compare_by_identity
.
Checks for a method provided by this the delegate object by forwarding the call through _getobj_.
The block passed to this method will be called just before running the RDoc
generator. It is allowed to modify RDoc::Task
attributes inside the block.
Convenience method for Shell::CommandProcessor.undef_system_command
Iterates the given block for each element with an arbitrary object given, and returns the initially given object.
If no block is given, returns an enumerator.
evens = (1..10).each_with_object([]) { |i, a| a << i*2 } #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
Sets a list of quote characters which can cause a word break.
Raises NotImplementedError
if the using readline library does not support.
Gets a list of quote characters which can cause a word break.
Raises NotImplementedError
if the using readline library does not support.
Set
the default id conversion object.
This is expected to be an instance such as DRb::DRbIdConv
that responds to to_id
and to_obj
that can convert objects to and from DRb
references.
See DRbServer#default_id_conv.
Set
the default id conversion object.
This is expected to be an instance such as DRb::DRbIdConv
that responds to to_id
and to_obj
that can convert objects to and from DRb
references.
See DRbServer#default_id_conv.
Returns whether or not the struct of type type
contains member
. If it does not, or the struct type can’t be found, then false is returned. You may optionally specify additional headers
in which to look for the struct (in addition to the common header files).
If found, a macro is passed as a preprocessor constant to the compiler using the type name and the member name, in uppercase, prepended with HAVE_
.
For example, if have_struct_member('struct foo', 'bar')
returned true, then the HAVE_STRUCT_FOO_BAR
preprocessor macro would be passed to the compiler.
HAVE_ST_BAR
is also defined for backward compatibility.
Quietly ensure the Gem directory dir
contains all the proper subdirectories. If we can’t create a directory due to a permission problem, then we will silently continue.
If mode
is given, missing directories are created with this mode.
World-writable directories will never be created.
locking methods.
locking methods.
Returns the result of the peer certificates verification. See verify(1) for error values and descriptions.
If no peer certificate was presented X509_V_OK is returned.
Adds the certificates in file
to the certificate store. The file
can contain multiple PEM-encoded certificates.