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
Waits for all children, returns an array of 2-element arrays; each subarray contains the integer pid and Process::Status
status for one of the reaped child processes:
pid0 = Process.spawn('ruby', '-e', 'exit 13') # => 325470 pid1 = Process.spawn('ruby', '-e', 'exit 14') # => 325495 Process.waitall # => [[325470, #<Process::Status: pid 325470 exit 13>], [325495, #<Process::Status: pid 325495 exit 14>]]
Avoids the potential for a child process to become 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.
This method is needed only when the parent process will never wait for the child process.
This example does not reap the second child process; that process appears as a zombie in the process status (ps
) output:
pid = Process.spawn('ruby', '-e', 'exit 13') # => 312691 sleep(1) # Find zombies. system("ps -ho pid,state -p #{pid}")
Output:
312716 Z
This example also does not reap the second child process, but it does detach the process so that it does not become a zombie:
pid = Process.spawn('ruby', '-e', 'exit 13') # => 313213 thread = Process.detach(pid) sleep(1) # => #<Process::Waiter:0x00007f038f48b838 run> system("ps -ho pid,state -p #{pid}") # Finds no zombies.
The waiting thread can return the pid of the detached child process:
thread.join.pid # => 313262
Detaches the current process from its controlling terminal and runs it in the background as system daemon; returns zero.
By default:
Changes the current working directory to the root directory.
Redirects $stdin, $stdout, and $stderr to the null device.
If optional argument nochdir
is true
, does not change the current working directory.
If optional argument noclose
is true
, does not redirect $stdin, $stdout, or $stderr.
Foo::Bar, = baz ^^^^^^^^
Compile a ConstantPathNode
node
Compile a ConstantTargetNode
node
Compile a MatchPredicateNode
node
Dispatch enter and leave events for AlternationPatternNode
nodes and continue walking the tree.
Dispatch enter and leave events for ConstantPathNode
nodes and continue walking the tree.
Dispatch enter and leave events for ConstantTargetNode
nodes and continue walking the tree.
Dispatch enter and leave events for EmbeddedStatementsNode
nodes and continue walking the tree.
Dispatch enter and leave events for MatchPredicateNode
nodes and continue walking the tree.
Inspect a ConstantPathNode
node.
Inspect a ConstantTargetNode
node.
Inspect a MatchPredicateNode
node.