The required_rubygems_version
constraint for this specification
A fallback is included because the original version of the specification API didn’t include that field, so some marshalled specs in the index have it set to nil
.
The required_rubygems_version
constraint for this specification
Called when the current thread exits. The scheduler is expected to implement this method in order to allow all waiting fibers to finalize their execution.
The suggested pattern is to implement the main event loop in the close
method.
Invoked by methods like Thread.join
, and by Mutex
, to signify that current Fiber
is blocked till further notice (e.g. unblock
) or till timeout
will pass.
blocker
is what we are waiting on, informational only (for debugging and logging). There are no guarantees about its value.
Expected to return boolean, specifying whether the blocking operation was successful or not.
Invoked to wake up Fiber
previously blocked with block
(for example, Mutex#lock
calls block
and Mutex#unlock
calls unblock
). The scheduler should use the fiber
parameter to understand which fiber is unblocked.
blocker
is what was awaited for, but it is informational only (for debugging and logging), and it is not guaranteed to be the same value as the blocker
for block
.
Implementation of the Fiber.schedule
. The method is expected to immediately run passed block of code in a separate non-blocking fiber, and to return that Fiber
.
Minimal suggested implementation is:
def fiber(&block) Fiber.new(blocking: false, &block).tap(&:resume) end
Like Enumerable#select
, but chains operation to be lazy-evaluated.
Returns the hash value of a given string. This is equivalent to Digest::Class.new(*parameters)
.digest(string), where extra parameters, if any, are passed through to the constructor and the string is passed to digest()
.
Returns the hex-encoded hash value of a given string. This is almost equivalent to Digest.hexencode
(Digest::Class.new(*parameters)
.digest(string)).
Returns the base64 encoded hash value of a given string. The return value is properly padded with ‘=’ and contains no line feeds.
Close this handle.
Calling close more than once will raise a Fiddle::DLError
exception.
Array
of the currently loaded libraries.
Allocates a C struct with the types
provided.
See Fiddle::Pointer.malloc
for memory management issues.
# Automatically freeing the pointer when the block is exited - recommended Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) do |pointer| ... end # Manually freeing but relying on the garbage collector otherwise pointer = Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) ... pointer.call_free # Relying on the garbage collector - may lead to unlimited memory allocated before freeing any, but safe pointer = Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) ... # Only manually freeing pointer = Fiddle::Pointer.malloc(size) begin ... ensure Fiddle.free pointer end # No free function and no call to free - the native memory will leak if the pointer is garbage collected pointer = Fiddle::Pointer.malloc(size) ...
Allocate size
bytes of memory and associate it with an optional freefunc
.
If a block is supplied, the pointer will be yielded to the block instead of being returned, and the return value of the block will be returned. A freefunc
must be supplied if a block is.
If a freefunc
is supplied it will be called once, when the pointer is garbage collected or when the block is left if a block is supplied or when the user calls call_free
, whichever happens first. freefunc
must be an address pointing to a function or an instance of Fiddle::Function
.
Returns the names of all available ciphers in an array.
Return the hash value computed with name Digest
. name is either the long name or short name of a supported digest algorithm.
OpenSSL::Digest.digest("SHA256", "abc")
which is equivalent to:
OpenSSL::Digest.digest('SHA256', "abc")
Returns the authentication code as a binary string. The digest parameter specifies the digest algorithm to use. This may be a String
representing the algorithm name or an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' hmac = OpenSSL::HMAC.digest('sha1', key, data) #=> "\xDE|\x9B\x85\xB8\xB7\x8A\xA6\xBC\x8Az6\xF7\n\x90p\x1C\x9D\xB4\xD9"
Returns the authentication code as a hex-encoded string. The digest parameter specifies the digest algorithm to use. This may be a String
representing the algorithm name or an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' hmac = OpenSSL::HMAC.hexdigest('sha1', key, data) #=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
Returns the authentication code an instance represents as a binary string.
instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1')) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.digest #=> "\xF4+\xB0\xEE\xB0\x18\xEB\xBDE\x97\xAEr\x13q\x1E\xC6\a`\x84?"
Returns the authentication code an instance represents as a hex-encoded string.
This method loads engines. If name is nil, then all builtin engines are loaded. Otherwise, the given name, as a String
, is loaded if available to your runtime, and returns true. If name is not found, then nil is returned.