Need to be able to set the sources without calling Gem.sources
.replace since that would cause an infinite loop.
DOC: This comment is not documentation about the method itself, it’s more of a code comment about the implementation.
Open3.capture3
captures the standard output and the standard error of a command.
stdout_str, stderr_str, status = Open3.capture3([env,] cmd... [, opts])
The arguments env, cmd and opts are passed to Open3.popen3
except opts[:stdin_data]
and opts[:binmode]
. See Process.spawn
.
If opts[:stdin_data]
is specified, it is sent to the command’s standard input.
If opts[:binmode]
is true, internal pipes are set to binary mode.
Examples:
# dot is a command of graphviz. graph = <<'End' digraph g { a -> b } End drawn_graph, dot_log = Open3.capture3("dot -v", :stdin_data=>graph) o, e, s = Open3.capture3("echo abc; sort >&2", :stdin_data=>"foo\nbar\nbaz\n") p o #=> "abc\n" p e #=> "bar\nbaz\nfoo\n" p s #=> #<Process::Status: pid 32682 exit 0> # generate a thumbnail image using the convert command of ImageMagick. # However, if the image is really stored in a file, # system("convert", "-thumbnail", "80", "png:#{filename}", "png:-") is better # because of reduced memory consumption. # But if the image is stored in a DB or generated by the gnuplot Open3.capture2 example, # Open3.capture3 should be considered. # image = File.read("/usr/share/openclipart/png/animals/mammals/sheep-md-v0.1.png", :binmode=>true) thumbnail, err, s = Open3.capture3("convert -thumbnail 80 png:- png:-", :stdin_data=>image, :binmode=>true) if s.success? STDOUT.binmode; print thumbnail end
Open3.capture3
captures the standard output and the standard error of a command.
stdout_str, stderr_str, status = Open3.capture3([env,] cmd... [, opts])
The arguments env, cmd and opts are passed to Open3.popen3
except opts[:stdin_data]
and opts[:binmode]
. See Process.spawn
.
If opts[:stdin_data]
is specified, it is sent to the command’s standard input.
If opts[:binmode]
is true, internal pipes are set to binary mode.
Examples:
# dot is a command of graphviz. graph = <<'End' digraph g { a -> b } End drawn_graph, dot_log = Open3.capture3("dot -v", :stdin_data=>graph) o, e, s = Open3.capture3("echo abc; sort >&2", :stdin_data=>"foo\nbar\nbaz\n") p o #=> "abc\n" p e #=> "bar\nbaz\nfoo\n" p s #=> #<Process::Status: pid 32682 exit 0> # generate a thumbnail image using the convert command of ImageMagick. # However, if the image is really stored in a file, # system("convert", "-thumbnail", "80", "png:#{filename}", "png:-") is better # because of reduced memory consumption. # But if the image is stored in a DB or generated by the gnuplot Open3.capture2 example, # Open3.capture3 should be considered. # image = File.read("/usr/share/openclipart/png/animals/mammals/sheep-md-v0.1.png", :binmode=>true) thumbnail, err, s = Open3.capture3("convert -thumbnail 80 png:- png:-", :stdin_data=>image, :binmode=>true) if s.success? STDOUT.binmode; print thumbnail end
Open3.capture2
captures the standard output of a command.
stdout_str, status = Open3.capture2([env,] cmd... [, opts])
The arguments env, cmd and opts are passed to Open3.popen3
except opts[:stdin_data]
and opts[:binmode]
. See Process.spawn
.
If opts[:stdin_data]
is specified, it is sent to the command’s standard input.
If opts[:binmode]
is true, internal pipes are set to binary mode.
Example:
# factor is a command for integer factorization. o, s = Open3.capture2("factor", :stdin_data=>"42") p o #=> "42: 2 3 7\n" # generate x**2 graph in png using gnuplot. gnuplot_commands = <<"End" set terminal png plot x**2, "-" with lines 1 14 2 1 3 8 4 5 e End image, s = Open3.capture2("gnuplot", :stdin_data=>gnuplot_commands, :binmode=>true)
Open3.capture2
captures the standard output of a command.
stdout_str, status = Open3.capture2([env,] cmd... [, opts])
The arguments env, cmd and opts are passed to Open3.popen3
except opts[:stdin_data]
and opts[:binmode]
. See Process.spawn
.
If opts[:stdin_data]
is specified, it is sent to the command’s standard input.
If opts[:binmode]
is true, internal pipes are set to binary mode.
Example:
# factor is a command for integer factorization. o, s = Open3.capture2("factor", :stdin_data=>"42") p o #=> "42: 2 3 7\n" # generate x**2 graph in png using gnuplot. gnuplot_commands = <<"End" set terminal png plot x**2, "-" with lines 1 14 2 1 3 8 4 5 e End image, s = Open3.capture2("gnuplot", :stdin_data=>gnuplot_commands, :binmode=>true)
Open3.capture2e
captures the standard output and the standard error of a command.
stdout_and_stderr_str, status = Open3.capture2e([env,] cmd... [, opts])
The arguments env, cmd and opts are passed to Open3.popen3
except opts[:stdin_data]
and opts[:binmode]
. See Process.spawn
.
If opts[:stdin_data]
is specified, it is sent to the command’s standard input.
If opts[:binmode]
is true, internal pipes are set to binary mode.
Example:
# capture make log make_log, s = Open3.capture2e("make")
Open3.capture2e
captures the standard output and the standard error of a command.
stdout_and_stderr_str, status = Open3.capture2e([env,] cmd... [, opts])
The arguments env, cmd and opts are passed to Open3.popen3
except opts[:stdin_data]
and opts[:binmode]
. See Process.spawn
.
If opts[:stdin_data]
is specified, it is sent to the command’s standard input.
If opts[:binmode]
is true, internal pipes are set to binary mode.
Example:
# capture make log make_log, s = Open3.capture2e("make")
Performs a Miller-Rabin probabilistic primality test with checks iterations. If checks is not specified, a number of iterations is used that yields a false positive rate of at most 2^-80 for random input.
checks - integer
Same as IO
.
Same as IO
.
Same as IO
.
Returns true
if stat is writable by the effective user id of this process.
File.stat("testfile").writable? #=> true
A detailed description of this gem. See also summary
Symmetric Householder reduction to tridiagonal form.
Sends a SUBSCRIBE command to add the specified mailbox
name to the server’s set of “active” or “subscribed” mailboxes as returned by lsub()
.
A Net::IMAP::NoResponseError
is raised if mailbox
cannot be subscribed to; for instance, because it does not exist.
Sends a UNSUBSCRIBE command to remove the specified mailbox
name from the server’s set of “active” or “subscribed” mailboxes.
A Net::IMAP::NoResponseError
is raised if mailbox
cannot be unsubscribed from; for instance, because the client is not currently subscribed to it.
returns whether verify_mode is enable from POP3.ssl_params