Returns true
if the named file is readable by the effective user and group id of this process. See eaccess(3).
Note that some OS-level security features may cause this to return true even though the file is not readable by the effective user/group.
Returns true
if the named file is writable by the effective user and group id of this process. See eaccess(3).
Note that some OS-level security features may cause this to return true even though the file is not writable by the effective user/group.
Returns true
if the named file is executable by the effective user and group id of this process. See eaccess(3).
Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in .bat, .cmd, .com, or .exe.
Note that some OS-level security features may cause this to return true even though the file is not executable by the effective user/group.
Initiates garbage collection, even if manually disabled.
The full_mark
keyword argument determines whether or not to perform a major garbage collection cycle. When set to true
, a major garbage collection cycle is ran, meaning all objects are marked. When set to false
, a minor garbage collection cycle is ran, meaning only young objects are marked.
The immediate_mark
keyword argument determines whether or not to perform incremental marking. When set to true
, marking is completed during the call to this method. When set to false
, marking is performed in steps that is interleaved with future Ruby code execution, so marking might not be completed during this method call. Note that if full_mark
is false
then marking will always be immediate, regardless of the value of immediate_mark
.
The immediate_sweep
keyword argument determines whether or not to defer sweeping (using lazy sweep). When set to false
, sweeping is performed in steps that is interleaved with future Ruby code execution, so sweeping might not be completed during this method call. When set to true
, sweeping is completed during the call to this method.
Note: These keyword arguments are implementation and version dependent. They are not guaranteed to be future-compatible, and may be ignored if the underlying implementation does not support them.
The standard configuration object for gems.
Use the given configuration object (which implements the ConfigFile
protocol) as the standard configuration object.
A Zlib::Deflate.deflate
wrapper
Retrieve the PathSupport
object that RubyGems uses to lookup files.
Initialize the filesystem paths to use from env
. env
is a hash-like object (typically ENV
) that is queried for ‘GEM_HOME’, ‘GEM_PATH’, and ‘GEM_SPEC_CACHE’ Keys for the env
hash should be Strings, and values of the hash should be Strings or nil
.
Top level install helper method. Allows you to install gems interactively:
% irb >> Gem.install "minitest" Fetching: minitest-5.14.0.gem (100%) => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
Set
array of platforms this RubyGems supports (primarily for testing).
Array
of platforms this RubyGems supports.
Returns the currently set formatter. By default, it is set to DidYouMean::Formatter
.
Updates the primary formatter used to format the suggestions.
Copies a file entry. See install(1).
Arguments src
(a single path or an array of paths) and dest
(a single path) should be interpretable as paths;
If the entry at dest
does not exist, copies from src
to dest
:
File.read('src0.txt') # => "aaa\n" File.exist?('dest0.txt') # => false FileUtils.install('src0.txt', 'dest0.txt') File.read('dest0.txt') # => "aaa\n"
If dest
is a file entry, copies from src
to dest
, overwriting:
File.read('src1.txt') # => "aaa\n" File.read('dest1.txt') # => "bbb\n" FileUtils.install('src1.txt', 'dest1.txt') File.read('dest1.txt') # => "aaa\n"
If dest
is a directory entry, copies from src
to dest/src
, overwriting if necessary:
File.read('src2.txt') # => "aaa\n" File.read('dest2/src2.txt') # => "bbb\n" FileUtils.install('src2.txt', 'dest2') File.read('dest2/src2.txt') # => "aaa\n"
If src
is an array of paths and dest
points to a directory, copies each path path
in src
to dest/path
:
File.file?('src3.txt') # => true File.file?('src3.dat') # => true FileUtils.mkdir('dest3') FileUtils.install(['src3.txt', 'src3.dat'], 'dest3') File.file?('dest3/src3.txt') # => true File.file?('dest3/src3.dat') # => true
Keyword arguments:
group: group
- changes the group if not nil
, using File.chown
.
mode: permissions
- changes the permissions. using File.chmod
.
noop: true
- does not copy entries; returns nil
.
owner: owner
- changes the owner if not nil
, using File.chown
.
preserve: true
- preserve timestamps using File.utime
.
verbose: true
- prints an equivalent command:
FileUtils.install('src0.txt', 'dest0.txt', noop: true, verbose: true) FileUtils.install('src1.txt', 'dest1.txt', noop: true, verbose: true) FileUtils.install('src2.txt', 'dest2', noop: true, verbose: true)
Output:
install -c src0.txt dest0.txt install -c src1.txt dest1.txt install -c src2.txt dest2
Related: methods for copying.
Copies a file entry. See install(1).
Arguments src
(a single path or an array of paths) and dest
(a single path) should be interpretable as paths;
If the entry at dest
does not exist, copies from src
to dest
:
File.read('src0.txt') # => "aaa\n" File.exist?('dest0.txt') # => false FileUtils.install('src0.txt', 'dest0.txt') File.read('dest0.txt') # => "aaa\n"
If dest
is a file entry, copies from src
to dest
, overwriting:
File.read('src1.txt') # => "aaa\n" File.read('dest1.txt') # => "bbb\n" FileUtils.install('src1.txt', 'dest1.txt') File.read('dest1.txt') # => "aaa\n"
If dest
is a directory entry, copies from src
to dest/src
, overwriting if necessary:
File.read('src2.txt') # => "aaa\n" File.read('dest2/src2.txt') # => "bbb\n" FileUtils.install('src2.txt', 'dest2') File.read('dest2/src2.txt') # => "aaa\n"
If src
is an array of paths and dest
points to a directory, copies each path path
in src
to dest/path
:
File.file?('src3.txt') # => true File.file?('src3.dat') # => true FileUtils.mkdir('dest3') FileUtils.install(['src3.txt', 'src3.dat'], 'dest3') File.file?('dest3/src3.txt') # => true File.file?('dest3/src3.dat') # => true
Keyword arguments:
group: group
- changes the group if not nil
, using File.chown
.
mode: permissions
- changes the permissions. using File.chmod
.
noop: true
- does not copy entries; returns nil
.
owner: owner
- changes the owner if not nil
, using File.chown
.
preserve: true
- preserve timestamps using File.utime
.
verbose: true
- prints an equivalent command:
FileUtils.install('src0.txt', 'dest0.txt', noop: true, verbose: true) FileUtils.install('src1.txt', 'dest1.txt', noop: true, verbose: true) FileUtils.install('src2.txt', 'dest2', noop: true, verbose: true)
Output:
install -c src0.txt dest0.txt install -c src1.txt dest1.txt install -c src2.txt dest2
Related: methods for copying.
Returns the singleton instance.
Returns the tangent of x
in radians.
Domain: (-INFINITY, INFINITY)
.
Range: (-INFINITY, INFINITY)
.
Examples:
tan(-PI) # => 1.2246467991473532e-16 # -0.0000000000000001 tan(-PI/2) # => -1.633123935319537e+16 # -16331239353195370.0 tan(0.0) # => 0.0 tan(PI/2) # => 1.633123935319537e+16 # 16331239353195370.0 tan(PI) # => -1.2246467991473532e-16 # -0.0000000000000001