Results for: "Array.new"

No documentation available

Creates a new Lazy enumerator. When the enumerator is actually enumerated (e.g. by calling force), obj will be enumerated and each value passed to the given block. The block can yield values back using yielder. For example, to create a “filter+map” enumerator:

def filter_map(sequence)
  Lazy.new(sequence) do |yielder, *values|
    result = yield *values
    yielder << result if result
  end
end

filter_map(1..Float::INFINITY) {|i| i*i if i.even?}.first(5)
#=> [4, 16, 36, 64, 100]

Generates a new enumerator object that iterates over the elements of given enumerable objects in sequence.

e = Enumerator::Chain.new(1..3, [4, 5])
e.to_a #=> [1, 2, 3, 4, 5]
e.size #=> 5

Generates a new enumerator object that generates a Cartesian product of given enumerable objects.

e = Enumerator::Product.new(1..3, [4, 5])
e.to_a #=> [[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5]]
e.size #=> 6

Create a new SHA2 hash object with a given bit length.

Valid bit lengths are 256, 384 and 512.

Construct a new Closure object.

If there is an error in preparing the ffi_cif or ffi_prep_closure, then a RuntimeError will be raised.

Constructs a Function object.

Create a new handler that opens library with flags.

If no library is specified or nil is given, DEFAULT is used, which is the equivalent to RTLD_DEFAULT. See man 3 dlopen for more.

lib = Fiddle::Handle.new

The default is dependent on OS, and provide a handle for all libraries already loaded. For example, in most cases you can use this to access libc functions, or ruby functions like rb_str_new.

Create a new handler with the open handlers

Used internally by Fiddle::Importer.dlload

No documentation available

Wraps the C pointer addr as a C struct with the given types.

When the instance is garbage collected, the C function func is called.

See also Fiddle::Pointer.new

Create a new pinned object reference. The Fiddle::Pinned instance will prevent the GC from moving object.

Create a new pointer to address with an optional size and freefunc.

freefunc will be called when the instance is garbage collected.

No documentation available

Construct a new OpenSSL BIGNUM object.

If bn is an Integer or OpenSSL::BN, a new instance of OpenSSL::BN representing the same value is returned. See also Integer#to_bn for the short-hand.

If a String is given, the content will be parsed according to base.

string

The string to be parsed.

base

The format. Must be one of the following:

  • 0 - MPI format. See the man page BN_mpi2bn(3) for details.

  • 2 - Variable-length and big-endian binary encoding of a positive number.

  • 10 - Decimal number representation, with a leading ‘-’ for a negative number.

  • 16 - Hexadeciaml number representation, with a leading ‘-’ for a negative number.

The string must contain a valid cipher name like “aes-256-cbc”.

A list of cipher names is available by calling OpenSSL::Cipher.ciphers.

Creates a Digest instance based on string, which is either the ln (long name) or sn (short name) of a supported digest algorithm.

If data (a String) is given, it is used as the initial input to the Digest instance, i.e.

digest = OpenSSL::Digest.new('sha256', 'digestdata')

is equivalent to

digest = OpenSSL::Digest.new('sha256')
digest.update('digestdata')

Returns an instance of OpenSSL::HMAC set with the key and digest algorithm to be used. The instance represents the initial state of the message authentication code before any data has been processed. To process data with it, use the instance method update with your data as an argument.

Example

key = 'key'
instance = OpenSSL::HMAC.new(key, 'SHA1')
#=> f42bb0eeb018ebbd4597ae7213711ec60760843f
instance.class
#=> OpenSSL::HMAC

A note about comparisons

Two instances can be securely compared with == in constant time:

    other_instance = OpenSSL::HMAC.new('key', 'SHA1')
#=> f42bb0eeb018ebbd4597ae7213711ec60760843f
instance == other_instance
#=> true

Creates an instance of OpenSSL::Config from the content of the file specified by filename.

This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=

This can raise IO exceptions based on the access, or availability of the file. A ConfigError exception may be raised depending on the validity of the data being configured.

Parameters

Many methods in this class aren’t documented.

No documentation available
No documentation available
No documentation available
No documentation available
Search took: 5ms  ·  Total Results: 2278