Computes the inverse hyperbolic tangent of x
.
Domain: (-1, 1)
Codomain: (-INFINITY, INFINITY)
Math.atanh(1) #=> Infinity
Sends the given signal to the specified process id(s) if pid is positive. If pid is zero signal is sent to all processes whose group ID is equal to the group ID of the process. signal may be an integer signal number or a POSIX signal name (either with or without a SIG
prefix). If signal is negative (or starts with a minus sign), kills process groups instead of processes. Not all signals are available on all platforms. The keys and values of Signal.list
are known signal names and numbers, respectively.
pid = fork do Signal.trap("HUP") { puts "Ouch!"; exit } # ... do some work ... end # ... Process.kill("HUP", pid) Process.wait
produces:
Ouch!
If signal is an integer but wrong for signal, Errno::EINVAL
or RangeError
will be raised. Otherwise unless signal is a String
or a Symbol
, and a known signal name, ArgumentError
will be raised.
Also, Errno::ESRCH
or RangeError
for invalid pid, Errno::EPERM
when failed because of no privilege, will be raised. In these cases, signals may have been sent to preceding processes.
Some operating systems retain the status of terminated child processes until the parent collects that status (normally using some variant of wait()
). If the parent never collects this status, the child stays around as a zombie process. Process::detach
prevents this by setting up a separate Ruby thread whose sole job is to reap the status of the process pid when it terminates. Use detach
only when you do not intend to explicitly wait for the child to terminate.
The waiting thread returns the exit status of the detached process when it terminates, so you can use Thread#join
to know the result. If specified pid is not a valid child process ID, the thread returns nil
immediately.
The waiting thread has pid
method which returns the pid.
In this first example, we don’t reap the first child process, so it appears as a zombie in the process status display.
p1 = fork { sleep 0.1 } p2 = fork { sleep 0.2 } Process.waitpid(p2) sleep 2 system("ps -ho pid,state -p #{p1}")
produces:
27389 Z
In the next example, Process::detach
is used to reap the child automatically.
p1 = fork { sleep 0.1 } p2 = fork { sleep 0.2 } Process.detach(p1) Process.waitpid(p2) sleep 2 system("ps -ho pid,state -p #{p1}")
(produces no output)
Get all gem names from the command line.
Returns every spec that matches name
and optional requirements
.
wait for all jobs to terminate
Activate TLS_FALLBACK_SCSV for this context. See RFC 7507.
Creates a CRAM-MD5 challenge. You can view more information on CRAM-MD5 on Wikipedia: en.wikipedia.org/wiki/CRAM-MD5
Returns true
if this is a null pointer.
Returns the remaining data held in the cipher object. Further calls to Cipher#update
or Cipher#final
will return garbage. This call should always be made as the last call of an encryption or decryption operation, after having fed the entire plaintext or ciphertext to the Cipher
instance.
If an authenticated cipher was used, a CipherError
is raised if the tag could not be authenticated successfully. Only call this method after setting the authentication tag and passing the entire contents of the ciphertext into the cipher.
Emit a scalar with value
Called when an alias is found to anchor
. anchor
will be the name of the anchor found.
Here we have an example of an array that references itself in YAML:
--- &ponies - first element - *ponies
&ponies is the achor, *ponies is the alias. In this case, alias is called with “ponies”.
Called when a scalar value
is found. The scalar may have an anchor
, a tag
, be implicitly plain
or implicitly quoted
value
is the string value of the scalar anchor
is an associated anchor or nil tag
is an associated tag or nil plain
is a boolean value quoted
is a boolean value style
is an integer idicating the string style
See the constants in Psych::Nodes::Scalar
for the possible values of style
Here is a YAML document that exercises most of the possible ways this method can be called:
--- - !str "foo" - &anchor fun - many lines - | many newlines
The above YAML document contains a list with four strings. Here are the parameters sent to this method in the same order:
# value anchor tag plain quoted style ["foo", nil, "!str", false, false, 3 ] ["fun", "anchor", nil, true, false, 1 ] ["many lines", nil, nil, true, false, 1 ] ["many\nnewlines\n", nil, nil, false, true, 4 ]