Returns true
if the named file has the setuid bit set.
file_name can be an IO
object.
Returns true
if the named file has the setgid bit set.
file_name can be an IO
object.
Returns true
if the named file has the sticky bit set.
file_name can be an IO
object.
Returns true
if the named files are identical.
file_1 and file_2 can be an IO
object.
open("a", "w") {} p File.identical?("a", "a") #=> true p File.identical?("a", "./a") #=> true File.link("a", "b") p File.identical?("a", "b") #=> true File.symlink("a", "c") p File.identical?("a", "c") #=> true open("d", "w") {} p File.identical?("a", "d") #=> false
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 run, meaning all objects are marked. When set to false
, a minor garbage collection cycle is run, 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 are 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 are 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.
Sets or gets information about the current GC config.
Configuration parameters are GC implementation-specific and may change without notice.
This method can be called without parameters to retrieve the current config as a Hash
with Symbol
keys.
This method can also be called with a Hash
argument to assign values to valid config keys. Config keys missing from the passed Hash
will be left unmodified.
If a key/value pair is passed to this function that does not correspond to a valid config key for the GC implementation being used, no config will be updated, the key will be present in the returned Hash
, and its value will be nil
. This is to facilitate easy migration between GC implementations.
In both call-seqs, the return value of GC.config
will be a Hash
containing the most recent full configuration, i.e., all keys and values defined by the specific GC implementation being used. In the case of a config update, the return value will include the new values being updated.
This method is only expected to work on CRuby.
The GC.config
hash can also contain keys that are global and read-only. These keys are not specific to any one GC library implementation and attempting to write to them will raise ArgumentError
.
There is currently only one global, read-only key:
Returns a String
containing the name of the currently loaded GC library, if one has been loaded using RUBY_GC_LIBRARY
, and “default” in all other cases
GC libraries are expected to document their own configuration. Valid keys for Ruby’s default GC implementation are:
Controls whether the GC is allowed to run a full mark (young & old objects).
When true
, GC interleaves major and minor collections. This is the default. GC will function as intended.
When false
, the GC will never trigger a full marking cycle unless explicitly requested by user code. Instead, only a minor mark will run—only young objects will be marked. When the heap space is exhausted, new pages will be allocated immediately instead of running a full mark.
A flag will be set to notify that a full mark has been requested. This flag is accessible using GC.latest_gc_info(:need_major_by)
The user can trigger a major collection at any time using GC.start(full_mark: true)
When false
, Young to Old object promotion is disabled. For performance reasons, it is recommended to warm up an application using Process.warmup
before setting this parameter to false
.
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
.
Prints the amount of time the supplied block takes to run using the debug UI output.
Returns the currently set formatter. By default, it is set to DidYouMean::Formatter
.
Updates the primary formatter used to format the suggestions.
Returns true
if the file at path new
is newer than all the files at paths in array old_list
; false
otherwise.
Argument new
and the elements of old_list
should be interpretable as paths:
FileUtils.uptodate?('Rakefile', ['Gemfile', 'README.md']) # => true FileUtils.uptodate?('Gemfile', ['Rakefile', 'README.md']) # => false
A non-existent file is considered to be infinitely old.
Related: FileUtils.touch
.
Returns true
if the file at path new
is newer than all the files at paths in array old_list
; false
otherwise.
Argument new
and the elements of old_list
should be interpretable as paths:
FileUtils.uptodate?('Rakefile', ['Gemfile', 'README.md']) # => true FileUtils.uptodate?('Gemfile', ['Rakefile', 'README.md']) # => false
A non-existent file is considered to be infinitely old.
Related: FileUtils.touch
.
Executes command similarly to xsystem, but yields opened pipe.