Returns true
if key is the corresponding private key to the Subject Public Key Information, false
otherwise.
Like Enumerable#map
, but chains operation to be lazy-evaluated.
(1..Float::INFINITY).lazy.map {|i| i**2 } #=> #<Enumerator::Lazy: #<Enumerator::Lazy: 1..Infinity>:map> (1..Float::INFINITY).lazy.map {|i| i**2 }.first(3) #=> [1, 4, 9]
Like Enumerable#chunk
, but chains operation to be lazy-evaluated.
Iterates over the elements of the first enumerable by calling the “each” method on it with the given arguments, then proceeds to the following enumerables in sequence until all of the enumerables are exhausted.
If no block is given, returns an enumerator.
Iterates over the elements of the first enumerable by calling the “each_entry” method on it with the given arguments, then proceeds to the following enumerables in sequence until all of the enumerables are exhausted.
If no block is given, returns an enumerator. Otherwise, returns self.
Update the digest using given string and return self
.
Update the digest using a given string and return self.
Iterates for each entry in the /etc/passwd
file if a block is given.
If no block is given, returns the Enumerator
.
The code block is passed an Passwd
struct.
See Etc.getpwent
above for details.
Example:
require 'etc' Etc::Passwd.each {|u| puts u.name + " = " + u.gecos } Etc::Passwd.collect {|u| u.gecos} Etc::Passwd.collect {|u| u.gecos}
Iterates for each entry in the /etc/group
file if a block is given.
If no block is given, returns the Enumerator
.
The code block is passed a Group
struct.
Example:
require 'etc' Etc::Group.each {|g| puts g.name + ": " + g.mem.join(', ') } Etc::Group.collect {|g| g.name} Etc::Group.select {|g| !g.mem.empty?}
Create a new closure. If a block is given, the created closure is automatically freed after the given block is executed.
The all given arguments are passed to Fiddle::Closure.new
. So using this method without block equals to Fiddle::Closure.new
.
Fiddle::Closure.create(TYPE_INT, [TYPE_INT]) do |closure| # closure is freed automatically when this block is finished. end
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
.
Encrypts data in a streaming fashion. Hand consecutive blocks of data to the update
method in order to encrypt it. Returns the encrypted data chunk. When done, the output of Cipher#final
should be additionally added to the result.
If buffer is given, the encryption/decryption result will be written to it. buffer will be resized automatically.
Indicated whether this Cipher
instance uses an Authenticated Encryption mode.