[DOC] Improve docs for GC.latest_gc_info

This commit is contained in:
Peter Zhu 2024-09-18 11:40:01 -04:00
parent 6118e8a473
commit d9981beb40
Notes: git 2024-09-19 16:10:44 +00:00

8
gc.rb
View File

@ -312,13 +312,17 @@ module GC
# call-seq: # call-seq:
# GC.latest_gc_info -> hash # GC.latest_gc_info -> hash
# GC.latest_gc_info(hash) -> hash # GC.latest_gc_info(hash) -> hash
# GC.latest_gc_info(:major_by) -> :malloc # GC.latest_gc_info(key) -> value
# #
# Returns information about the most recent garbage collection. # Returns information about the most recent garbage collection.
# #
# If the optional argument, hash, is given, # If the argument +hash+ is given and is a Hash object,
# it is overwritten and returned. # it is overwritten and returned.
# This is intended to avoid probe effect. # This is intended to avoid probe effect.
#
# If the argument +key+ is given and is a Symbol object,
# it returns the value associated with the key.
# This is equivalent to <tt>GC.latest_gc_info[key]</tt>.
def self.latest_gc_info hash_or_key = nil def self.latest_gc_info hash_or_key = nil
if hash_or_key == nil if hash_or_key == nil
hash_or_key = {} hash_or_key = {}