Results for: "module_function"

Sets a thread local with key to value. Note that these are local to threads, and not to fibers. Please see Thread#thread_variable_get and Thread#[] for more information.

For debugging the Ruby/OpenSSL library. Calls CRYPTO_mem_leaks_fp(stderr). Prints detected memory leaks to standard error. This cleans the global state up thus you cannot use any methods of the library after calling this.

Returns true if leaks detected, false otherwise.

This is available only when built with a capable OpenSSL and –enable-debug configure option.

Example

OpenSSL.mem_check_start
NOT_GCED = OpenSSL::PKey::RSA.new(256)

END {
  GC.start
  OpenSSL.print_mem_leaks # will print the leakage
}

Safely loads the document contained in filename. Returns the yaml contained in filename as a Ruby object, or if the file is empty, it returns the specified fallback return value, which defaults to false. See safe_load for options.

This method removes a file system entry path. path shall be a regular file, a directory, or something. If path is a directory, remove it recursively. This method is required to avoid TOCTTOU (time-of-check-to-time-of-use) local security vulnerability of rm_r. rm_r causes security hole when:

To avoid this security hole, this method applies special preprocess. If path is a directory, this method chown(2) and chmod(2) all removing directories. This requires the current process is the owner of the removing whole directory tree, or is the super user (root).

WARNING: You must ensure that ALL parent directories cannot be moved by other untrusted users. For example, parent directories should not be owned by untrusted users, and should not be world writable except when the sticky bit set.

WARNING: Only the owner of the removing directory tree, or Unix super user (root) should invoke this method. Otherwise this method does not work.

For details of this security vulnerability, see Perl’s case:

For fileutils.rb, this vulnerability is reported in [ruby-dev:26100].

This method removes a file system entry path. path shall be a regular file, a directory, or something. If path is a directory, remove it recursively. This method is required to avoid TOCTTOU (time-of-check-to-time-of-use) local security vulnerability of rm_r. rm_r causes security hole when:

To avoid this security hole, this method applies special preprocess. If path is a directory, this method chown(2) and chmod(2) all removing directories. This requires the current process is the owner of the removing whole directory tree, or is the super user (root).

WARNING: You must ensure that ALL parent directories cannot be moved by other untrusted users. For example, parent directories should not be owned by untrusted users, and should not be world writable except when the sticky bit set.

WARNING: Only the owner of the removing directory tree, or Unix super user (root) should invoke this method. Otherwise this method does not work.

For details of this security vulnerability, see Perl’s case:

For fileutils.rb, this vulnerability is reported in [ruby-dev:26100].

Decodes URL-encoded form data from given str.

This decodes application/x-www-form-urlencoded data and returns an array of key-value arrays.

This refers url.spec.whatwg.org/#concept-urlencoded-parser, so this supports only &-separator, and doesn’t support ;-separator.

ary = URI.decode_www_form("a=1&a=2&b=3")
ary                   #=> [['a', '1'], ['a', '2'], ['b', '3']]
ary.assoc('a').last   #=> '1'
ary.assoc('b').last   #=> '3'
ary.rassoc('a').last  #=> '2'
Hash[ary]             #=> {"a"=>"2", "b"=>"3"}

See URI.decode_www_form_component, URI.encode_www_form.

Returns a list of paths matching glob from the latest gems that can be used by a gem to pick up features from other gems. For example:

Gem.find_latest_files('rdoc/discover').each do |path| load path end

if check_load_path is true (the default), then find_latest_files also searches $LOAD_PATH for files as well as gems.

Unlike find_files, find_latest_files will return only files from the latest version of a gem.

Register a Gem::Specification for default gem.

Two formats for the specification are supported:

Paths where RubyGems’ .rb files and bin files are installed

Deduce Ruby’s –program-prefix and –program-suffix from its install name

The default signing key path

The default signing certificate chain path

Should be implemented by a extended class.

tsort_each_node is used to iterate for all nodes over a graph.

Invoked by IO#wait, IO#wait_readable, IO#wait_writable to ask whether the specified descriptor is ready for specified events within the specified timeout.

events is a bit mask of IO::READABLE, IO::WRITABLE, and IO::PRIORITY.

Suggested implementation should register which Fiber is waiting for which resources and immediately calling Fiber.yield to pass control to other fibers. Then, in the close method, the scheduler might dispatch all the I/O resources to fibers waiting for it.

Expected to return the subset of events that are ready immediately.

Invoked by IO#read to read length bytes from io into a specified buffer (see IO::Buffer).

The length argument is the “minimum length to be read”. If the IO buffer size is 8KiB, but the length is 1024 (1KiB), up to 8KiB might be read, but at least 1KiB will be. Generally, the only case where less data than length will be read is if there is an error reading the data.

Specifying a length of 0 is valid and means try reading at least once and return any available data.

Suggested implementation should try to read from io in a non-blocking manner and call io_wait if the io is not ready (which will yield control to other fibers).

See IO::Buffer for an interface available to return data.

Expected to return number of bytes read, or, in case of an error, -errno (negated number corresponding to system’s error code).

The method should be considered experimental.

Invoked by IO#write to write length bytes to io from from a specified buffer (see IO::Buffer).

The length argument is the “(minimum) length to be written”. If the IO buffer size is 8KiB, but the length specified is 1024 (1KiB), at most 8KiB will be written, but at least 1KiB will be. Generally, the only case where less data than length will be written is if there is an error writing the data.

Specifying a length of 0 is valid and means try writing at least once, as much data as possible.

Suggested implementation should try to write to io in a non-blocking manner and call io_wait if the io is not ready (which will yield control to other fibers).

See IO::Buffer for an interface available to get data from buffer efficiently.

Expected to return number of bytes written, or, in case of an error, -errno (negated number corresponding to system’s error code).

The method should be considered experimental.

Invoked by Timeout.timeout to execute the given block within the given duration. It can also be invoked directly by the scheduler or user code.

Attempt to limit the execution time of a given block to the given duration if possible. When a non-blocking operation causes the block‘s execution time to exceed the specified duration, that non-blocking operation should be interrupted by raising the specified exception_class constructed with the given exception_arguments.

General execution timeouts are often considered risky. This implementation will only interrupt non-blocking operations. This is by design because it’s expected that non-blocking operations can fail for a variety of unpredictable reasons, so applications should already be robust in handling these conditions and by implication timeouts.

However, as a result of this design, if the block does not invoke any non-blocking operations, it will be impossible to interrupt it. If you desire to provide predictable points for timeouts, consider adding +sleep(0)+.

If the block is executed successfully, its result will be returned.

The exception will typically be raised using Fiber#raise.

accessor to Fiddle::CStructEntity

accessor to Fiddle::CUnionEntity

Calculates the offsets and sizes for the given types in the struct.

Calculate the necessary offset and for each union member with the given types

No documentation available
No documentation available
No documentation available
No documentation available
Search took: 7ms  ·  Total Results: 3178