Returns a Digest
subclass by name
require 'openssl' OpenSSL::Digest("MD5") # => OpenSSL::Digest::MD5 Digest("Foo") # => NameError: wrong constant name Foo
Returns a Digest
subclass by name
require 'openssl' OpenSSL::Digest("MD5") # => OpenSSL::Digest::MD5 Digest("Foo") # => NameError: wrong constant name Foo
Returns an inspect() string summarizing the object state.
Return true
if the named file exists.
file_name can be an IO
object.
“file exists” means that stat() or fstat() system call is successful.
Returns true
if the named file has the sticky bit set.
file_name can be an IO
object.
This function compacts objects together in Ruby’s heap. It eliminates unused space (or fragmentation) in the heap by moving objects in to that unused space. This function returns a hash which contains statistics about which objects were moved. See GC.latest_gc_info
for details about compaction statistics.
This method is implementation specific and not expected to be implemented in any implementation besides MRI.
To test whether GC compaction is supported, use the idiom:
GC.respond_to?(:compact)
Initiates garbage collection, even if manually disabled.
This method is defined with keyword arguments that default to true:
def GC.start(full_mark: true, immediate_sweep: true); end
Use full_mark: false to perform a minor GC. Use immediate_sweep: false to defer sweeping (use lazy sweep).
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 number of times GC occurred.
It returns the number of times GC occurred since the process started.
Returns a Hash
containing information about the GC.
The contents of the hash are implementation specific and may change in the future without notice.
The hash includes information about internal statistics about GC such as:
The total number of garbage collections ran since application start (count includes both minor and major garbage collections)
The total time spent in garbage collections (in milliseconds)
The total number of ‘:heap_eden_pages` + `:heap_tomb_pages`
The number of pages that can fit into the buffer that holds references to all pages
The total number of pages the application could allocate without additional GC
The total number of slots in all ‘:heap_allocated_pages`
The total number of slots which contain live objects
The total number of slots which do not contain live objects
The total number of slots with pending finalizers to be run
The total number of objects marked in the last GC
The total number of pages which contain at least one live slot
The total number of pages which do not contain any live slots
The cumulative number of pages allocated since application start
The cumulative number of pages freed since application start
The cumulative number of objects allocated since application start
The cumulative number of objects freed since application start
Amount of memory allocated on the heap for objects. Decreased by any GC
When ‘:malloc_increase_bytes` crosses this limit, GC is triggered
The total number of minor garbage collections run since process start
The total number of major garbage collections run since process start
The total number of compactions run since process start
The total number of times the read barrier was triggered during compaction
The total number of objects compaction has moved
The total number of objects without write barriers
When ‘:remembered_wb_unprotected_objects` crosses this limit, major GC is triggered
Number of live, old objects which have survived at least 3 garbage collections
When ‘:old_objects` crosses this limit, major GC is triggered
Amount of memory allocated on the heap for objects. Decreased by major GC
When ‘:old_malloc_increase_bytes` crosses this limit, major GC is triggered
If the optional argument, hash, is given, it is overwritten and returned. This is intended to avoid probe effect.
This method is only expected to work on CRuby.
Returns the Base64-encoded version of bin
. This method complies with RFC 2045. Line feeds are added to every 60 encoded characters.
require 'base64' Base64.encode64("Now is the time for all good coders\nto learn Ruby")
Generates:
Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g UnVieQ==
Returns the Base64-decoded version of str
. This method complies with RFC 2045. Characters outside the base alphabet are ignored.
require 'base64' str = 'VGhpcyBpcyBsaW5lIG9uZQpUaGlzIG' + 'lzIGxpbmUgdHdvClRoaXMgaXMgbGlu' + 'ZSB0aHJlZQpBbmQgc28gb24uLi4K' puts Base64.decode64(str)
Generates:
This is line one This is line two This is line three And so on...
Get the front object of the current server.
This raises a DRbServerNotFound
error if there is no current server. See current_server
.
Get the front object of the current server.
This raises a DRbServerNotFound
error if there is no current server. See current_server
.
Returns an array of the string names of FileUtils methods that accept one or more keyword arguments:
FileUtils.commands.sort.take(3) # => ["cd", "chdir", "chmod"]
Get the default RubyGems API host. This is normally https://rubygems.org
.
Set
the default RubyGems API host.
Raises a TypeError
to prevent cloning.
Returns the cosine of x
in radians.
Domain: (-INFINITY, INFINITY)
.
Range: [-1.0, 1.0]
.
Examples:
cos(-PI) # => -1.0 cos(-PI/2) # => 6.123031769111886e-17 # 0.0000000000000001 cos(0.0) # => 1.0 cos(PI/2) # => 6.123031769111886e-17 # 0.0000000000000001 cos(PI) # => -1.0
Returns the arc cosine of x
.
Domain: [-1, 1]
.
Range: [0, PI]
.
Examples:
acos(-1.0) # => 3.141592653589793 # PI acos(0.0) # => 1.5707963267948966 # PI/2 acos(1.0) # => 0.0
Returns the hyperbolic cosine of x
in radians.
Domain: [-INFINITY, INFINITY]
.
Range: [1, INFINITY]
.
Examples:
cosh(-INFINITY) # => Infinity cosh(0.0) # => 1.0 cosh(INFINITY) # => Infinity
Returns the inverse hyperbolic cosine of x
.
Domain: [1, INFINITY]
.
Range: [0, INFINITY]
.
Examples:
acosh(1.0) # => 0.0 acosh(INFINITY) # => Infinity
Returns a list of signal names mapped to the corresponding underlying signal numbers.
Signal.list #=> {"EXIT"=>0, "HUP"=>1, "INT"=>2, "QUIT"=>3, "ILL"=>4, "TRAP"=>5, "IOT"=>6, "ABRT"=>6, "FPE"=>8, "KILL"=>9, "BUS"=>7, "SEGV"=>11, "SYS"=>31, "PIPE"=>13, "ALRM"=>14, "TERM"=>15, "URG"=>23, "STOP"=>19, "TSTP"=>20, "CONT"=>18, "CHLD"=>17, "CLD"=>17, "TTIN"=>21, "TTOU"=>22, "IO"=>29, "XCPU"=>24, "XFSZ"=>25, "VTALRM"=>26, "PROF"=>27, "WINCH"=>28, "USR1"=>10, "USR2"=>12, "PWR"=>30, "POLL"=>29}
Sets the remote network access for all composed sets.