Dump a list of objects as separate documents to a document stream.
Example:
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
Load multiple documents given in yaml
. Returns the parsed documents as a list. If a block is given, each document will be converted to Ruby and passed to the block during parsing
Example:
Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar'] list = [] Psych.load_stream("--- foo\n...\n--- bar\n...") do |ruby| list << ruby end list # => ['foo', 'bar']
Adds a post-install hook that will be passed an Gem::Installer
instance when Gem::Installer#install
is called
Adds a post-uninstall hook that will be passed a Gem::Uninstaller
instance and the spec that was uninstalled when Gem::Uninstaller#uninstall
is called
Copies IO stream src
to IO stream dest
via IO.copy_stream
.
Related: methods for copying.
Copies IO stream src
to IO stream dest
via IO.copy_stream
.
Related: methods for copying.
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
.
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.
This lexes with the Ripper
lex. It drops any space events but otherwise returns the same tokens. Raises SyntaxError
if the syntax in source is invalid.
Mirror the Prism.parse_stream
API by using the serialization API.
Returns a Process::Status
object representing the most recently exited child process in the current thread, or nil
if none:
Process.spawn('ruby', '-e', 'exit 13') Process.wait Process.last_status # => #<Process::Status: pid 14396 exit 13> Process.spawn('ruby', '-e', 'exit 14') Process.wait Process.last_status # => #<Process::Status: pid 4692 exit 14> Process.spawn('ruby', '-e', 'exit 15') # 'exit 15' has not been reaped by #wait. Process.last_status # => #<Process::Status: pid 4692 exit 14> Process.wait Process.last_status # => #<Process::Status: pid 1380 exit 15>
Is this handler a streaming handler?
Override to display a longer description of what this command does.
A detailed description of this gem. See also summary
Returns attributes.
Setter for attributes val
.
Creates a class to wrap the C struct described by signature
.
MyStruct = struct ['int i', 'char c']
in “” in “foo”