Retrieves data from the queue.
If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block
is true, the thread isn’t suspended, and ThreadError
is raised.
If timeout
seconds have passed and no data is available nil
is returned. If timeout
is 0
it returns immediately.
Similar to Thread::Queue#close
.
The difference is behavior with waiting enqueuing threads.
If there are waiting enqueuing threads, they are interrupted by raising ClosedQueueError(‘queue closed’).
Returns true
if the queue is empty.
Removes all objects from the queue.
Retrieves data from the queue.
If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block
is true, the thread isn’t suspended, and ThreadError
is raised.
If timeout
seconds have passed and no data is available nil
is returned. If timeout
is 0
it returns immediately.
Returns URL-escaped string following RFC 3986.
Returns URL-unescaped string following RFC 3986.
URL-encode a string following RFC 3986 Space characters (+“ ”+) are encoded with (+“%20”+)
url_encoded_string = CGI.escape("'Stop!' said Fred") # => "%27Stop%21%27%20said%20Fred"
URL-decode a string following RFC 3986 with encoding(optional).
string = CGI.unescape("%27Stop%21%27+said%20Fred") # => "'Stop!'+said Fred"
Resets the digest to the initial state and returns self.
This method is overridden by each implementation subclass.
If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.
If a string
is given, returns the hash value for the given string
in a base64 encoded form, resetting the digest to the initial state before and after the process.
In either case, the return value is properly padded with ‘=’ and contains no line feeds.
Returns the resulting hash value and resets the digest to the initial state.
Creates a global method from the given C signature
.
The Fiddle::CompositeHandler
instance
Will raise an error if no handlers are open.
Like getc
, but raises an exception if already at end-of-stream; see Character IO.
Reads a one-character string from the stream. Raises an EOFError
at end of file.
Closes the SSLSocket and flushes any unwritten data.
Derives a key from pass using given parameters with the scrypt password-based key derivation function. The result can be used for password storage.
scrypt is designed to be memory-hard and more secure against brute-force attacks using custom hardwares than alternative KDFs such as PBKDF2 or bcrypt.
The keyword arguments N, r and p can be used to tune scrypt. RFC 7914 (published on 2016-08, tools.ietf.org/html/rfc7914#section-2) states that using values r=8 and p=1 appears to yield good results.
See RFC 7914 (tools.ietf.org/html/rfc7914) for more information.
Passphrase.
Salt.
CPU/memory cost parameter. This must be a power of 2.
Block size parameter.
Parallelization parameter.
Length in octets of the derived key.
pass = "password" salt = SecureRandom.random_bytes(16) dk = OpenSSL::KDF.scrypt(pass, salt: salt, N: 2**14, r: 8, p: 1, length: 32) p dk #=> "\xDA\xE4\xE2...\x7F\xA1\x01T"
::seed
is equivalent to ::add where entropy is length of str.
Start streaming using encoding
Clears the GC profiler data.
Generate a Document Base URI
element as a String
.
href
can either by a string, giving the base URL for the HREF attribute, or it can be a has of the element’s attributes.
The passed-in no-argument block is ignored.
base("http://www.example.com/cgi") # => "<BASE HREF=\"http://www.example.com/cgi\">"