Returns a new lazy enumerator with the concatenated results of running block
once for every element in the lazy enumerator.
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force #=> ["f", "o", "o", "b", "a", "r"]
A value x
returned by block
is decomposed if either of the following conditions is true:
x
responds to both each and force, which means that x
is a lazy enumerator.
x
is an array or responds to to_ary.
Otherwise, x
is contained as-is in the return value.
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force #=> [{:a=>1}, {:b=>2}]
Returns a new lazy enumerator with the concatenated results of running block
once for every element in the lazy enumerator.
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force #=> ["f", "o", "o", "b", "a", "r"]
A value x
returned by block
is decomposed if either of the following conditions is true:
x
responds to both each and force, which means that x
is a lazy enumerator.
x
is an array or responds to to_ary.
Otherwise, x
is contained as-is in the return value.
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force #=> [{:a=>1}, {:b=>2}]
If a block is given, iterates the given block for each element with an index, which starts from offset
, and returns a lazy enumerator that yields the same values (without the index).
If a block is not given, returns a new lazy enumerator that includes the index, starting from offset
.
offset
the starting index to use
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#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#select
, but chains operation to be lazy-evaluated.
Like Enumerable#select
, but chains operation to be lazy-evaluated.
Like Enumerable#reject
, but chains operation to be lazy-evaluated.
Like Enumerable#grep
, but chains operation to be lazy-evaluated.
Like Enumerable#grep_v
, but chains operation to be lazy-evaluated.
Like Enumerable#zip
, but chains operation to be lazy-evaluated. However, if a block is given to zip, values are enumerated immediately.
Like Enumerable#take
, but chains operation to be lazy-evaluated.
Like Enumerable#drop
, but chains operation to be lazy-evaluated.
Like Enumerable#uniq
, but chains operation to be lazy-evaluated.
Return the length of the hash value in bytes.
Return the block length of the digest in bytes.
Return the block length of the digest in bytes.
Digest::SHA256.new.block_length * 8 # => 512 Digest::SHA384.new.block_length * 8 # => 1024 Digest::SHA512.new.block_length * 8 # => 1024
Return the length of the hash value (the digest) in bytes.
Digest::SHA256.new.digest_length * 8 # => 256 Digest::SHA384.new.digest_length * 8 # => 384 Digest::SHA512.new.digest_length * 8 # => 512
For example, digests produced by Digest::SHA256 will always be 32 bytes (256 bits) in size.
Enable a call to dlclose() when this handle is garbage collected.
Returns true
if dlclose() will be called when this handle is garbage collected.
See man(3) dlclose() for more info.
Performs a Miller-Rabin primality test. This is same as prime?
except this first attempts trial divisions with some small primes.
checks - integer
trial_div - boolean
Sets the authentication tag to verify the integrity of the ciphertext. This can be called only when the cipher supports AE. The tag must be set after calling Cipher#decrypt
, Cipher#key=
and Cipher#iv=
, but before calling Cipher#final
. After all decryption is performed, the tag is verified automatically in the call to Cipher#final
.
For OCB mode, the tag length must be supplied with auth_tag_len=
beforehand.