Returns the hyperbolic tangent of x
in radians.
Domain: [-INFINITY, INFINITY]
.
Range: [-1, 1]
.
Examples:
tanh(-INFINITY) # => -1.0 tanh(0.0) # => 0.0 tanh(INFINITY) # => 1.0
Returns the inverse hyperbolic tangent of x
.
Domain: [-1, 1]
.
Range: [-INFINITY, INFINITY]
.
Examples:
atanh(-1.0) # => -Infinity atanh(0.0) # => 0.0 atanh(1.0) # => 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. If pid is negative, results are dependent on the operating system. 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)
Example:
x.foo ^^^^ x.foo(42) ^^^^ x&.foo ^^^^^ x[42] ^^^^ x += 1 ^
State
Transition Table Serialization
Get all gem names from the command line.
Returns every spec that matches name
and optional requirements
.
Activate TLS_FALLBACK_SCSV for this context. See RFC 7507.
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#take
, but chains operation to be lazy-evaluated.
Returns true
if this is a null pointer.
Wakes up the first thread in line waiting for this lock.
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.