Removes the entry given by path
, which should be the entry for a regular file, a symbolic link, or a directory.
Argument path
should be interpretable as a path.
Optional argument force
specifies whether to ignore raised exceptions of StandardError
and its descendants.
Related: FileUtils.remove_entry_secure
.
Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names, instance variable names, or constant names (see def_delegator
). The value is the accessor to which the methods will be delegated.
Returns the language-dependent source file name for configuration checks.
Registers the given klass
as the class to be instantiated when parsing a URI with the given scheme
:
URI.register_scheme('MS_SEARCH', URI::Generic) # => URI::Generic URI.scheme_list['MS_SEARCH'] # => URI::Generic
Note that after calling String#upcase
on scheme
, it must be a valid constant name.
Returns a hash of the defined schemes:
URI.scheme_list # => {"MAILTO"=>URI::MailTo, "LDAPS"=>URI::LDAPS, "WS"=>URI::WS, "HTTP"=>URI::HTTP, "HTTPS"=>URI::HTTPS, "LDAP"=>URI::LDAP, "FILE"=>URI::File, "FTP"=>URI::FTP}
Related: URI.register_scheme
.
Basically a wrapper for Process.spawn
that:
Creates a child process for each of the given cmds
by calling Process.spawn
.
Pipes the stdout
from each child to the stdin
of the next child, or, for the first child, from the caller’s stdin
, or, for the last child, to the caller’s stdout
.
The method does not wait for child processes to exit, so the caller must do so.
With no block given, returns a 3-element array containing:
The stdin
stream of the first child process.
The stdout
stream of the last child process.
An array of the wait threads for all of the child processes.
Example:
first_stdin, last_stdout, wait_threads = Open3.pipeline_rw('sort', 'cat -n') # => [#<IO:fd 20>, #<IO:fd 21>, [#<Process::Waiter:0x000055e8de29ab40 sleep>, #<Process::Waiter:0x000055e8de29a690 sleep>]] first_stdin.puts("foo\nbar\nbaz") first_stdin.close # Send EOF to sort. puts last_stdout.read wait_threads.each do |wait_thread| wait_thread.join end
Output:
1 bar 2 baz 3 foo
With a block given, calls the block with the stdin
stream of the first child, the stdout
stream of the last child, and an array of the wait processes:
Open3.pipeline_rw('sort', 'cat -n') do |first_stdin, last_stdout, wait_threads| first_stdin.puts "foo\nbar\nbaz" first_stdin.close # send EOF to sort. puts last_stdout.read wait_threads.each do |wait_thread| wait_thread.join end end
Output:
1 bar 2 baz 3 foo
Like Process.spawn
, this method has potential security vulnerabilities if called with untrusted input; see Command Injection.
If the first argument is a hash, it becomes leading argument env
in each call to Process.spawn
; see Execution Environment.
If the last argument is a hash, it becomes trailing argument options
in each call to Process.spawn
; see Execution Options.
Each remaining argument in cmds
is one of:
A command_line
: a string that begins with a shell reserved word or special built-in, or contains one or more metacharacters.
An exe_path
: the string path to an executable to be called.
An array containing a command_line
or an exe_path
, along with zero or more string arguments for the command.
Basically a wrapper for Process.spawn
that:
Creates a child process for each of the given cmds
by calling Process.spawn
.
Pipes the stdout
from each child to the stdin
of the next child, or, for the first child, from the caller’s stdin
, or, for the last child, to the caller’s stdout
.
The method does not wait for child processes to exit, so the caller must do so.
With no block given, returns a 3-element array containing:
The stdin
stream of the first child process.
The stdout
stream of the last child process.
An array of the wait threads for all of the child processes.
Example:
first_stdin, last_stdout, wait_threads = Open3.pipeline_rw('sort', 'cat -n') # => [#<IO:fd 20>, #<IO:fd 21>, [#<Process::Waiter:0x000055e8de29ab40 sleep>, #<Process::Waiter:0x000055e8de29a690 sleep>]] first_stdin.puts("foo\nbar\nbaz") first_stdin.close # Send EOF to sort. puts last_stdout.read wait_threads.each do |wait_thread| wait_thread.join end
Output:
1 bar 2 baz 3 foo
With a block given, calls the block with the stdin
stream of the first child, the stdout
stream of the last child, and an array of the wait processes:
Open3.pipeline_rw('sort', 'cat -n') do |first_stdin, last_stdout, wait_threads| first_stdin.puts "foo\nbar\nbaz" first_stdin.close # send EOF to sort. puts last_stdout.read wait_threads.each do |wait_thread| wait_thread.join end end
Output:
1 bar 2 baz 3 foo
Like Process.spawn
, this method has potential security vulnerabilities if called with untrusted input; see Command Injection.
If the first argument is a hash, it becomes leading argument env
in each call to Process.spawn
; see Execution Environment.
If the last argument is a hash, it becomes trailing argument options
in each call to Process.spawn
; see Execution Options.
Each remaining argument in cmds
is one of:
A command_line
: a string that begins with a shell reserved word or special built-in, or contains one or more metacharacters.
An exe_path
: the string path to an executable to be called.
An array containing a command_line
or an exe_path
, along with zero or more string arguments for the command.
Returns a clock resolution as determined by POSIX function clock_getres():
Process.clock_getres(:CLOCK_REALTIME) # => 1.0e-09
See Process.clock_gettime
for the values of clock_id
and unit
.
Examples:
Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :float_microsecond) # => 0.001 Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :float_millisecond) # => 1.0e-06 Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :float_second) # => 1.0e-09 Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :microsecond) # => 0 Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :millisecond) # => 0 Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :nanosecond) # => 1 Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :second) # => 0
In addition to the values for unit
supported in Process.clock_gettime
, this method supports :hertz
, the integer number of clock ticks per second (which is the reciprocal of :float_second
):
Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz) # => 100.0 Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :float_second) # => 0.01
Accuracy: Note that the returned resolution may be inaccurate on some platforms due to underlying bugs. Inaccurate resolutions have been reported for various clocks including :CLOCK_MONOTONIC
and :CLOCK_MONOTONIC_RAW
on Linux, macOS, BSD or AIX platforms, when using ARM processors, or when using virtualization.
Visit a destructured positional parameter node.
def foo((bar, baz)); end
^^^^^^^^^^
@foo += bar ^^^^^^^^^^^
@foo &&= bar ^^^^^^^^^^^^
@foo ||= bar ^^^^^^^^^^^^
@foo += bar ^^^^^^^^^^^
@foo &&= bar ^^^^^^^^^^^^
@foo ||= bar ^^^^^^^^^^^^
Compile a ClassVariableOperatorWriteNode
node