Returns the date-time format; see datetime_format=
.
Shows version string in packages if Version
is defined.
pkgs
package list
Ruby tries to load the library named string relative to the directory containing the requiring file. If the file does not exist a LoadError
is raised. Returns true
if the file was loaded and false
if the file was already loaded before.
Leaves exclusive section.
Enters exclusive section and executes the block. Leaves the exclusive section automatically when the block exits. See example under MonitorMixin
.
Constant time memory comparison. Inputs are hashed using SHA-256 to mask the length of the secret. Returns true
if the strings are identical, false
otherwise.
Parse a file at filename
. Returns the Psych::Nodes::Document
.
Raises a Psych::SyntaxError
when a YAML
syntax error is detected.
Parse a YAML
string in yaml
. Returns the Psych::Nodes::Stream
. This method can handle multiple YAML
documents contained in yaml
. filename
is used in the exception message if a Psych::SyntaxError
is raised.
If a block is given, a Psych::Nodes::Document
node will be yielded to the block as it’s being parsed.
Raises a Psych::SyntaxError
when a YAML
syntax error is detected.
Example:
Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00> Psych.parse_stream("--- a\n--- b") do |node| node # => #<Psych::Nodes::Document:0x00> end begin Psych.parse_stream("--- `", filename: "file.txt") rescue Psych::SyntaxError => ex ex.file # => 'file.txt' ex.message # => "(file.txt): found character that cannot start any token" end
Raises a TypeError
when NilClass
is passed.
See Psych::Nodes
for more information about YAML
AST.
Returns the version of libyaml being used
Returns the string which represents the version of zlib library.
Returns the measured GC total time in nanoseconds.
Try to activate a gem containing path
. Returns true if activation succeeded or wasn’t needed because it was already activated. Returns false if it can’t find the path in a gem.
Reset the dir
and path
values. The next time dir
or path
is requested, the values will be calculated from scratch. This is mainly used by the unit tests to provide test isolation.
The RbConfig
object for the deployment target platform.
This is usually the same as the running platform, but may be different if you are cross-compiling.
Safely write a file in binary mode on all platforms.
A Gem::Version
for the currently running Ruby.
A Gem::Version
for the currently running RubyGems
Returns true
if the contents of files a
and b
are identical, false
otherwise.
Arguments a
and b
should be interpretable as a path.
FileUtils.identical?
and FileUtils.cmp
are aliases for FileUtils.compare_file
.
Related: FileUtils.compare_stream
.
Returns true
if the contents of files a
and b
are identical, false
otherwise.
Arguments a
and b
should be interpretable as a path.
FileUtils.identical?
and FileUtils.cmp
are aliases for FileUtils.compare_file
.
Related: FileUtils.compare_stream
.
Returns true
if the contents of streams a
and b
are identical, false
otherwise.
Arguments a
and b
should be interpretable as a path.
Related: FileUtils.compare_file
.
Returns true
if the contents of streams a
and b
are identical, false
otherwise.
Arguments a
and b
should be interpretable as a path.
Related: FileUtils.compare_file
.
Tests for the presence of a --with-
config or --without-
config option. Returns true
if the with option is given, false
if the without option is given, and the default value otherwise.
This can be useful for adding custom definitions, such as debug information.
Example:
if with_config("debug") $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG" end
Basically a wrapper for Process.spawn
that:
Creates a child process for each of the given cmds
by calling Process.spawn
.
Does not wait for child processes to exit.
With no block given, returns an array of the wait threads for all of the child processes.
Example:
wait_threads = Open3.pipeline_start('ls', 'grep R') # => [#<Process::Waiter:0x000055e8de9d2bb0 run>, #<Process::Waiter:0x000055e8de9d2890 run>] wait_threads.each do |wait_thread| wait_thread.join end
Output:
Rakefile README.md
With a block given, calls the block with an array of the wait processes:
Open3.pipeline_start('ls', 'grep R') do |wait_threads| wait_threads.each do |wait_thread| wait_thread.join end end
Output:
Rakefile README.md
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
.
Does not wait for child processes to exit.
With no block given, returns an array of the wait threads for all of the child processes.
Example:
wait_threads = Open3.pipeline_start('ls', 'grep R') # => [#<Process::Waiter:0x000055e8de9d2bb0 run>, #<Process::Waiter:0x000055e8de9d2890 run>] wait_threads.each do |wait_thread| wait_thread.join end
Output:
Rakefile README.md
With a block given, calls the block with an array of the wait processes:
Open3.pipeline_start('ls', 'grep R') do |wait_threads| wait_threads.each do |wait_thread| wait_thread.join end end
Output:
Rakefile README.md
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.
Mirror the Prism.parse_file
API by using the serialization API. This uses native strings instead of Ruby strings because it allows us to use mmap when it is available.