Results for: "module_function"

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.

Sets self to compare keys using identity (rather than mere equality); returns self:

By default, two keys are considered to be the same key if and only if they are equal objects (per method ==):

h = {}
h['x'] = 0
h['x'] = 1 # Overwrites.
h # => {"x"=>1}

When this method has been called, two keys are considered to be the same key if and only if they are the same object:

h.compare_by_identity
h['x'] = 2 # Does not overwrite.
h # => {"x"=>1, "x"=>2}

Related: compare_by_identity?; see also Methods for Comparing.

Returns whether compare_by_identity has been called:

h = {}
h.compare_by_identity? # => false
h.compare_by_identity
h.compare_by_identity? # => true

Related: compare_by_identity; see also Methods for Comparing.

Returns IO instance tied to ARGF for writing if inplace mode is enabled.

Checks for a method provided by this the delegate object by forwarding the call through _getobj_.

Handle BasicObject instances

Return the native thread ID which is used by the Ruby thread.

The ID depends on the OS. (not POSIX thread ID returned by pthread_self(3))

NOTE: If the thread is not associated yet or already deassociated with a native thread, it returns nil. If the Ruby implementation uses M:N thread model, the ID may change depending on the timing.

Calls the block once for each element, passing both the element and the given object:

(1..4).each_with_object([]) {|i, a| a.push(i**2) }
# => [1, 4, 9, 16]

{foo: 0, bar: 1, baz: 2}.each_with_object({}) {|(k, v), h| h[v] = k }
# => {0=>:foo, 1=>:bar, 2=>:baz}

With no block given, returns an Enumerator.

Enables measuring GC time. You can get the result with GC.stat(:time). Note that GC time measurement can cause some performance overhead.

Returns the measure_total_time flag (default: true). Note that measurement can affect the application’s performance.

No documentation available

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.

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.

alias $foo $bar ^^^^^^^^^^^^^^^

foo { |; bar| }

^^^

@@foo ^^^^^

@@foo = 1 ^^^^^^^^^

@@foo, = bar ^^^^^

$foo ^^^^

$foo = 1 ^^^^^^^^

$foo, = bar ^^^^

foo ^^^

Search took: 4ms  ·  Total Results: 3346