Sets the key length of the cipher. If the cipher is a fixed length cipher then attempting to set the key length to any value other than the fixed value is an error.
Under normal circumstances you do not need to call this method (and probably shouldn’t).
See EVP_CIPHER_CTX_set_key_length for further information.
Returns the key length in bytes of the Cipher
.
Sets the IV/nonce length of the Cipher
. Normally block ciphers don’t allow changing the IV length, but some make use of IV for ‘nonce’. You may need this for interoperability with other applications.
Returns the expected length in bytes for an IV for this Cipher
.
Returns the output size of the digest, i.e. the length in bytes of the final message digest result.
digest = OpenSSL::Digest.new('SHA1') puts digest.digest_length # => 20
Returns the block length of the digest algorithm, i.e. the length in bytes of an individual block. Most modern algorithms partition a message to be digested into a sequence of fix-sized blocks that are processed consecutively.
digest = OpenSSL::Digest.new('SHA1') puts digest.block_length # => 64
Set
the defaults for this engine with the given flag.
These flags are used to control combinations of algorithm methods.
flag can be one of the following, other flags are available depending on your OS.
0xFFFF
0x0000
See also <openssl/engine.h>
Builds a methods for level meth
.
Delete a registry value named name. We can not delete the ‘default’ value.
Delete a subkey named name and all its values.
If recursive is false, the subkey must not have subkeys. Otherwise, this method deletes all subkeys and values recursively.
Returns OS code number recorded in the gzip file header.
Returns true
if stat is readable by the real user id of this process.
File.stat("testfile").readable_real? #=> true
If stat is readable by others, returns an integer representing the file permission bits of stat. Returns nil
otherwise. The meaning of the bits is platform dependent; on Unix systems, see stat(2)
.
m = File.stat("/etc/passwd").world_readable? #=> 420 sprintf("%o", m) #=> "644"
Returns true
if stat is writable by the real user id of this process.
File.stat("testfile").writable_real? #=> true
If stat is writable by others, returns an integer representing the file permission bits of stat. Returns nil
otherwise. The meaning of the bits is platform dependent; on Unix systems, see stat(2)
.
m = File.stat("/tmp").world_writable? #=> 511 sprintf("%o", m) #=> "777"
Same as executable?
, but tests using the real owner of the process.
Removes fields from self
as selected by the block; returns self
.
Removes each field for which the block returns a truthy value:
source = "Name,Name,Name\nFoo,Bar,Baz\n" table = CSV.parse(source, headers: true) row = table[0] row.delete_if {|header, value| value.start_with?('B') } # => true row # => #<CSV::Row "Name":"Foo"> row.delete_if {|header, value| header.start_with?('B') } # => false
If no block is given, returns a new Enumerator:
row.delete_if # => #<Enumerator: #<CSV::Row "Name":"Foo">:delete_if>
Removes rows or columns for which the block returns a truthy value; returns self
.
Removes rows when the access mode is :row
or :col_or_row
; calls the block with each CSV::Row object:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.by_row! # => #<CSV::Table mode:row row_count:4> table.size # => 3 table.delete_if {|row| row['Name'].start_with?('b') } table.size # => 1
Removes columns when the access mode is :col
; calls the block with each column as a 2-element array containing the header and an Array of column fields:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.by_col! # => #<CSV::Table mode:col row_count:4> table.headers.size # => 2 table.delete_if {|column_data| column_data[1].include?('2') } table.headers.size # => 1
Returns a new Enumerator if no block is given:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.delete_if # => #<Enumerator: #<CSV::Table mode:col_or_row row_count:4>:delete_if>