[DOC] Doc compliance (#9955)

This commit is contained in:
Burdette Lamar 2024-02-14 09:47:42 -06:00 committed by GitHub
parent f1136e73e8
commit 65f5435540
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 48 additions and 48 deletions

View File

@ -5647,7 +5647,7 @@ rb_ary_union_multi(int argc, VALUE *argv, VALUE ary)
* a.intersect?(b) #=> true * a.intersect?(b) #=> true
* a.intersect?(c) #=> false * a.intersect?(c) #=> false
* *
* Array elements are compared using <tt>eql?</tt> * +Array+ elements are compared using <tt>eql?</tt>
* (items must also implement +hash+ correctly). * (items must also implement +hash+ correctly).
*/ */

View File

@ -94,7 +94,7 @@ class Array
# a.sample # => 8 # a.sample # => 8
# If +self+ is empty, returns +nil+. # If +self+ is empty, returns +nil+.
# #
# When argument +n+ is given, returns a new \Array containing +n+ random # When argument +n+ is given, returns a new +Array+ containing +n+ random
# elements from +self+: # elements from +self+:
# a.sample(3) # => [8, 9, 2] # a.sample(3) # => [8, 9, 2]
# a.sample(6) # => [9, 6, 10, 3, 1, 4] # a.sample(6) # => [9, 6, 10, 3, 1, 4]
@ -106,7 +106,7 @@ class Array
# a.sample(a.size * 2) # => [1, 1, 3, 2, 1, 2] # a.sample(a.size * 2) # => [1, 1, 3, 2, 1, 2]
# The argument +n+ must be a non-negative numeric value. # The argument +n+ must be a non-negative numeric value.
# The order of the result array is unrelated to the order of +self+. # The order of the result array is unrelated to the order of +self+.
# Returns a new empty \Array if +self+ is empty. # Returns a new empty +Array+ if +self+ is empty.
# #
# The optional +random+ argument will be used as the random number generator: # The optional +random+ argument will be used as the random number generator:
# a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
@ -137,7 +137,7 @@ class Array
# If +self+ is empty, returns +nil+. # If +self+ is empty, returns +nil+.
# #
# When non-negative Integer argument +n+ is given, # When non-negative Integer argument +n+ is given,
# returns the first +n+ elements in a new \Array: # returns the first +n+ elements in a new +Array+:
# #
# a = [:foo, 'bar', 2] # a = [:foo, 'bar', 2]
# a.first(2) # => [:foo, "bar"] # a.first(2) # => [:foo, "bar"]
@ -147,7 +147,7 @@ class Array
# a = [:foo, 'bar', 2] # a = [:foo, 'bar', 2]
# a.first(50) # => [:foo, "bar", 2] # a.first(50) # => [:foo, "bar", 2]
# #
# If <tt>n == 0</tt> returns an new empty \Array: # If <tt>n == 0</tt> returns an new empty +Array+:
# #
# a = [:foo, 'bar', 2] # a = [:foo, 'bar', 2]
# a.first(0) # [] # a.first(0) # []
@ -181,7 +181,7 @@ class Array
# If +self+ is empty, returns +nil+. # If +self+ is empty, returns +nil+.
# #
# When non-negative Integer argument +n+ is given, # When non-negative Integer argument +n+ is given,
# returns the last +n+ elements in a new \Array: # returns the last +n+ elements in a new +Array+:
# #
# a = [:foo, 'bar', 2] # a = [:foo, 'bar', 2]
# a.last(2) # => ["bar", 2] # a.last(2) # => ["bar", 2]
@ -191,7 +191,7 @@ class Array
# a = [:foo, 'bar', 2] # a = [:foo, 'bar', 2]
# a.last(50) # => [:foo, "bar", 2] # a.last(50) # => [:foo, "bar", 2]
# #
# If <tt>n == 0</tt>, returns an new empty \Array: # If <tt>n == 0</tt>, returns an new empty +Array+:
# #
# a = [:foo, 'bar', 2] # a = [:foo, 'bar', 2]
# a.last(0) # [] # a.last(0) # []

6
hash.c
View File

@ -6682,7 +6682,7 @@ static const rb_data_type_t env_data_type = {
* # Raises SyntaxError (syntax error, unexpected ':', expecting =>): * # Raises SyntaxError (syntax error, unexpected ':', expecting =>):
* h = {0: 'zero'} * h = {0: 'zero'}
* *
* Hash value can be omitted, meaning that value will be fetched from the context * +Hash+ value can be omitted, meaning that value will be fetched from the context
* by the name of the key: * by the name of the key:
* *
* x = 0 * x = 0
@ -6733,7 +6733,7 @@ static const rb_data_type_t env_data_type = {
* *
* You can create a +Hash+ by calling method Hash.new. * You can create a +Hash+ by calling method Hash.new.
* *
* Create an empty Hash: * Create an empty +Hash+:
* *
* h = Hash.new * h = Hash.new
* h # => {} * h # => {}
@ -6741,7 +6741,7 @@ static const rb_data_type_t env_data_type = {
* *
* You can create a +Hash+ by calling method Hash.[]. * You can create a +Hash+ by calling method Hash.[].
* *
* Create an empty Hash: * Create an empty +Hash+:
* *
* h = Hash[] * h = Hash[]
* h # => {} * h # => {}

View File

@ -2268,7 +2268,7 @@ rb_str_empty(VALUE str)
* call-seq: * call-seq:
* string + other_string -> new_string * string + other_string -> new_string
* *
* Returns a new \String containing +other_string+ concatenated to +self+: * Returns a new +String+ containing +other_string+ concatenated to +self+:
* *
* "Hello from " + self.to_s # => "Hello from main" * "Hello from " + self.to_s # => "Hello from main"
* *
@ -2339,7 +2339,7 @@ rb_str_opt_plus(VALUE str1, VALUE str2)
* call-seq: * call-seq:
* string * integer -> new_string * string * integer -> new_string
* *
* Returns a new \String containing +integer+ copies of +self+: * Returns a new +String+ containing +integer+ copies of +self+:
* *
* "Ho! " * 3 # => "Ho! Ho! Ho! " * "Ho! " * 3 # => "Ho! Ho! Ho! "
* "Ho! " * 0 # => "" * "Ho! " * 0 # => ""
@ -2714,14 +2714,14 @@ rb_check_string_type(VALUE str)
* call-seq: * call-seq:
* String.try_convert(object) -> object, new_string, or nil * String.try_convert(object) -> object, new_string, or nil
* *
* If +object+ is a \String object, returns +object+. * If +object+ is a +String+ object, returns +object+.
* *
* Otherwise if +object+ responds to <tt>:to_str</tt>, * Otherwise if +object+ responds to <tt>:to_str</tt>,
* calls <tt>object.to_str</tt> and returns the result. * calls <tt>object.to_str</tt> and returns the result.
* *
* Returns +nil+ if +object+ does not respond to <tt>:to_str</tt>. * Returns +nil+ if +object+ does not respond to <tt>:to_str</tt>.
* *
* Raises an exception unless <tt>object.to_str</tt> returns a \String object. * Raises an exception unless <tt>object.to_str</tt> returns a +String+ object.
*/ */
static VALUE static VALUE
rb_str_s_try_convert(VALUE dummy, VALUE str) rb_str_s_try_convert(VALUE dummy, VALUE str)
@ -3056,7 +3056,7 @@ str_uplus(VALUE str)
* *
* Returns a frozen, possibly pre-existing copy of the string. * Returns a frozen, possibly pre-existing copy of the string.
* *
* The returned \String will be deduplicated as long as it does not have * The returned +String+ will be deduplicated as long as it does not have
* any instance variables set on it and is not a String subclass. * any instance variables set on it and is not a String subclass.
* *
* Note that <tt>-string</tt> variant is more convenient for defining * Note that <tt>-string</tt> variant is more convenient for defining
@ -3749,7 +3749,7 @@ rb_str_cmp(VALUE str1, VALUE str2)
* Returns +false+ if the two strings' encodings are not compatible: * Returns +false+ if the two strings' encodings are not compatible:
* "\u{e4 f6 fc}".encode("ISO-8859-1") == ("\u{c4 d6 dc}") # => false * "\u{e4 f6 fc}".encode("ISO-8859-1") == ("\u{c4 d6 dc}") # => false
* *
* If +object+ is not an instance of \String but responds to +to_str+, then the * If +object+ is not an instance of +String+ but responds to +to_str+, then the
* two strings are compared using <code>object.==</code>. * two strings are compared using <code>object.==</code>.
*/ */
@ -4873,7 +4873,7 @@ static VALUE str_succ(VALUE str);
* s = '99zz99zz' * s = '99zz99zz'
* s.succ # => "100aa00aa" * s.succ # => "100aa00aa"
* *
* The successor to an empty \String is a new empty \String: * The successor to an empty +String+ is a new empty +String+:
* *
* ''.succ # => "" * ''.succ # => ""
* *
@ -5013,7 +5013,7 @@ str_upto_i(VALUE str, VALUE arg)
* upto(other_string, exclusive = false) {|string| ... } -> self * upto(other_string, exclusive = false) {|string| ... } -> self
* upto(other_string, exclusive = false) -> new_enumerator * upto(other_string, exclusive = false) -> new_enumerator
* *
* With a block given, calls the block with each \String value * With a block given, calls the block with each +String+ value
* returned by successive calls to String#succ; * returned by successive calls to String#succ;
* the first value is +self+, the next is <tt>self.succ</tt>, and so on; * the first value is +self+, the next is <tt>self.succ</tt>, and so on;
* the sequence terminates when value +other_string+ is reached; * the sequence terminates when value +other_string+ is reached;
@ -6663,8 +6663,8 @@ rb_str_to_f(VALUE str)
* call-seq: * call-seq:
* to_s -> self or string * to_s -> self or string
* *
* Returns +self+ if +self+ is a \String, * Returns +self+ if +self+ is a +String+,
* or +self+ converted to a \String if +self+ is a subclass of \String. * or +self+ converted to a +String+ if +self+ is a subclass of +String+.
*/ */
static VALUE static VALUE
@ -11517,17 +11517,17 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
/********************************************************************** /**********************************************************************
* Document-class: Symbol * Document-class: Symbol
* *
* \Symbol objects represent named identifiers inside the Ruby interpreter. * A +Symbol+ object represents a named identifier inside the Ruby interpreter.
* *
* You can create a \Symbol object explicitly with: * You can create a +Symbol+ object explicitly with:
* *
* - A {symbol literal}[rdoc-ref:syntax/literals.rdoc@Symbol+Literals]. * - A {symbol literal}[rdoc-ref:syntax/literals.rdoc@Symbol+Literals].
* *
* The same \Symbol object will be * The same +Symbol+ object will be
* created for a given name or string for the duration of a program's * created for a given name or string for the duration of a program's
* execution, regardless of the context or meaning of that name. Thus * execution, regardless of the context or meaning of that name. Thus
* if <code>Fred</code> is a constant in one context, a method in * if <code>Fred</code> is a constant in one context, a method in
* another, and a class in a third, the \Symbol <code>:Fred</code> * another, and a class in a third, the +Symbol+ <code>:Fred</code>
* will be the same object in all three contexts. * will be the same object in all three contexts.
* *
* module One * module One
@ -11570,18 +11570,18 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
* local_variables * local_variables
* # => [:seven] * # => [:seven]
* *
* \Symbol objects are different from String objects in that * A +Symbol+ object differs from a String object in that
* \Symbol objects represent identifiers, while String objects * a +Symbol+ object represents an identifier, while a String object
* represent text or data. * represents text or data.
* *
* == What's Here * == What's Here
* *
* First, what's elsewhere. \Class \Symbol: * First, what's elsewhere. \Class +Symbol+:
* *
* - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here]. * - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
* - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here]. * - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here].
* *
* Here, class \Symbol provides methods that are useful for: * Here, class +Symbol+ provides methods that are useful for:
* *
* - {Querying}[rdoc-ref:Symbol@Methods+for+Querying] * - {Querying}[rdoc-ref:Symbol@Methods+for+Querying]
* - {Comparing}[rdoc-ref:Symbol@Methods+for+Comparing] * - {Comparing}[rdoc-ref:Symbol@Methods+for+Comparing]

View File

@ -1,11 +1,11 @@
# A \String object has an arbitrary sequence of bytes, # A +String+ object has an arbitrary sequence of bytes,
# typically representing text or binary data. # typically representing text or binary data.
# A \String object may be created using String::new or as literals. # A +String+ object may be created using String::new or as literals.
# #
# String objects differ from Symbol objects in that Symbol objects are # String objects differ from Symbol objects in that Symbol objects are
# designed to be used as identifiers, instead of text or data. # designed to be used as identifiers, instead of text or data.
# #
# You can create a \String object explicitly with: # You can create a +String+ object explicitly with:
# #
# - A {string literal}[rdoc-ref:syntax/literals.rdoc@String+Literals]. # - A {string literal}[rdoc-ref:syntax/literals.rdoc@String+Literals].
# - A {heredoc literal}[rdoc-ref:syntax/literals.rdoc@Here+Document+Literals]. # - A {heredoc literal}[rdoc-ref:syntax/literals.rdoc@Here+Document+Literals].
@ -14,7 +14,7 @@
# #
# - \Method #String. # - \Method #String.
# #
# Some \String methods modify +self+. # Some +String+ methods modify +self+.
# Typically, a method whose name ends with <tt>!</tt> modifies +self+ # Typically, a method whose name ends with <tt>!</tt> modifies +self+
# and returns +self+; # and returns +self+;
# often a similarly named method (without the <tt>!</tt>) # often a similarly named method (without the <tt>!</tt>)
@ -64,14 +64,14 @@
# #
# 'THX1138'.gsub('\d+', '00') # => "THX1138" # 'THX1138'.gsub('\d+', '00') # => "THX1138"
# #
# <b>\String +replacement+</b> # <b>+String+ +replacement+</b>
# #
# If +replacement+ is a string, that string will determine # If +replacement+ is a string, that string will determine
# the replacing string that is to be substituted for the matched text. # the replacing string that is to be substituted for the matched text.
# #
# Each of the examples above uses a simple string as the replacing string. # Each of the examples above uses a simple string as the replacing string.
# #
# \String +replacement+ may contain back-references to the pattern's captures: # +String+ +replacement+ may contain back-references to the pattern's captures:
# #
# - <tt>\n</tt> (_n_ a non-negative integer) refers to <tt>$n</tt>. # - <tt>\n</tt> (_n_ a non-negative integer) refers to <tt>$n</tt>.
# - <tt>\k<name></tt> refers to the named capture +name+. # - <tt>\k<name></tt> refers to the named capture +name+.
@ -139,7 +139,7 @@
# #
# == Whitespace in Strings # == Whitespace in Strings
# #
# In class \String, _whitespace_ is defined as a contiguous sequence of characters # In class +String+, _whitespace_ is defined as a contiguous sequence of characters
# consisting of any mixture of the following: # consisting of any mixture of the following:
# #
# - NL (null): <tt>"\x00"</tt>, <tt>"\u0000"</tt>. # - NL (null): <tt>"\x00"</tt>, <tt>"\u0000"</tt>.
@ -157,7 +157,7 @@
# - #rstrip, #rstrip!: strip trailing whitespace. # - #rstrip, #rstrip!: strip trailing whitespace.
# - #strip, #strip!: strip leading and trailing whitespace. # - #strip, #strip!: strip leading and trailing whitespace.
# #
# == \String Slices # == +String+ Slices
# #
# A _slice_ of a string is a substring that is selected by certain criteria. # A _slice_ of a string is a substring that is selected by certain criteria.
# #
@ -290,7 +290,7 @@
# #
# <b><tt>string[substring]</tt></b> # <b><tt>string[substring]</tt></b>
# #
# When the single \String argument +substring+ is given, # When the single +String+ argument +substring+ is given,
# returns the substring from +self+ if found, otherwise +nil+: # returns the substring from +self+ if found, otherwise +nil+:
# #
# 'foo'['oo'] # => "oo" # 'foo'['oo'] # => "oo"
@ -298,12 +298,12 @@
# #
# == What's Here # == What's Here
# #
# First, what's elsewhere. \Class \String: # First, what's elsewhere. \Class +String+:
# #
# - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here]. # - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
# - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here]. # - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here].
# #
# Here, class \String provides methods that are useful for: # Here, class +String+ provides methods that are useful for:
# #
# - {Creating a String}[rdoc-ref:String@Methods+for+Creating+a+String] # - {Creating a String}[rdoc-ref:String@Methods+for+Creating+a+String]
# - {Frozen/Unfrozen Strings}[rdoc-ref:String@Methods+for+a+Frozen-2FUnfrozen+String] # - {Frozen/Unfrozen Strings}[rdoc-ref:String@Methods+for+a+Frozen-2FUnfrozen+String]
@ -314,7 +314,7 @@
# - {Converting to Non-String}[rdoc-ref:String@Methods+for+Converting+to+Non--5CString] # - {Converting to Non-String}[rdoc-ref:String@Methods+for+Converting+to+Non--5CString]
# - {Iterating}[rdoc-ref:String@Methods+for+Iterating] # - {Iterating}[rdoc-ref:String@Methods+for+Iterating]
# #
# === Methods for Creating a \String # === Methods for Creating a +String+
# #
# - ::new: Returns a new string. # - ::new: Returns a new string.
# - ::try_convert: Returns a new string created from a given object. # - ::try_convert: Returns a new string created from a given object.
@ -374,7 +374,7 @@
# - #casecmp?: Returns +true+ if the string is equal to a given string after Unicode case folding; # - #casecmp?: Returns +true+ if the string is equal to a given string after Unicode case folding;
# +false+ otherwise. # +false+ otherwise.
# #
# === Methods for Modifying a \String # === Methods for Modifying a +String+
# #
# Each of these methods modifies +self+. # Each of these methods modifies +self+.
# #
@ -428,9 +428,9 @@
# - #chop!: Removes trailing newline characters if found; otherwise removes the last character; # - #chop!: Removes trailing newline characters if found; otherwise removes the last character;
# returns +self+ if any changes, +nil+ otherwise. # returns +self+ if any changes, +nil+ otherwise.
# #
# === Methods for Converting to New \String # === Methods for Converting to New +String+
# #
# Each of these methods returns a new \String based on +self+, # Each of these methods returns a new +String+ based on +self+,
# often just a modified copy of +self+. # often just a modified copy of +self+.
# #
# _Extension_ # _Extension_
@ -494,12 +494,12 @@
# #
# _Duplication_ # _Duplication_
# #
# - #to_s, $to_str: If +self+ is a subclass of \String, returns +self+ copied into a \String; # - #to_s, $to_str: If +self+ is a subclass of +String+, returns +self+ copied into a +String+;
# otherwise, returns +self+. # otherwise, returns +self+.
# #
# === Methods for Converting to Non-\String # === Methods for Converting to Non-+String+
# #
# Each of these methods converts the contents of +self+ to a non-\String. # Each of these methods converts the contents of +self+ to a non-+String+.
# #
# <em>Characters, Bytes, and Clusters</em> # <em>Characters, Bytes, and Clusters</em>
# #

View File

@ -843,7 +843,7 @@ rb_gc_free_dsymbol(VALUE sym)
* str.intern -> symbol * str.intern -> symbol
* str.to_sym -> symbol * str.to_sym -> symbol
* *
* Returns the Symbol corresponding to <i>str</i>, creating the * Returns the +Symbol+ corresponding to <i>str</i>, creating the
* symbol if it did not previously exist. See Symbol#id2name. * symbol if it did not previously exist. See Symbol#id2name.
* *
* "Koala".intern #=> :Koala * "Koala".intern #=> :Koala