summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-09-18 11:40:01 -0400
committerPeter Zhu <[email protected]>2024-09-19 12:10:27 -0400
commitd9981beb40ae9ed4fdce788ed629b94a75f2761b (patch)
treef8886aff086ce1fd740787e937c05274b5ef9e02
parent6118e8a47394409b53164b60e79fadf348b97db3 (diff)
[DOC] Improve docs for GC.latest_gc_info
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11644
-rw-r--r--gc.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gc.rb b/gc.rb
index 32e68c690e..2a75e166ce 100644
--- a/gc.rb
+++ b/gc.rb
@@ -312,13 +312,17 @@ module GC
# call-seq:
# GC.latest_gc_info -> 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.
#
- # If the optional argument, hash, is given,
+ # If the argument +hash+ is given and is a Hash object,
# it is overwritten and returned.
# 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
if hash_or_key == nil
hash_or_key = {}