diff --git a/doc/_regexp.rdoc b/doc/_regexp.rdoc index aa55a7eebfc6ce..9e2a6a6e05fb93 100644 --- a/doc/_regexp.rdoc +++ b/doc/_regexp.rdoc @@ -26,14 +26,14 @@ A regexp may be used: re.match('good') # => nil See sections {Method match}[rdoc-ref:Regexp@Method+match] - and {Operator =~}[rdoc-ref:Regexp@Operator+-3D~]. + and {Operator =~}[rdoc-ref:Regexp@Operator-]. - To determine whether a string matches a given pattern: re.match?('food') # => true re.match?('good') # => false - See section {Method match?}[rdoc-ref:Regexp@Method+match-3F]. + See section {Method match?}[rdoc-ref:Regexp@Method+match]. - As an argument for calls to certain methods in other classes and modules; most such methods accept an argument that may be either a string @@ -64,7 +64,7 @@ A regular expression may be created with: /foo/ # => /foo/ - A %r regexp literal - (see {%r: Regexp Literals}[rdoc-ref:syntax/literals.rdoc@25r-3A+Regexp+Literals]): + (see {%r: Regexp Literals}[rdoc-ref:syntax/literals.rdoc@r-regexp+literals]): # Same delimiter character at beginning and end; # useful for avoiding escaping characters @@ -113,7 +113,7 @@ none sets {global variables}[rdoc-ref:Regexp@Global+Variables]: Certain regexp-oriented methods assign values to global variables: - #match: see {Method match}[rdoc-ref:Regexp@Method+match]. -- #=~: see {Operator =~}[rdoc-ref:Regexp@Operator+-3D~]. +- #=~: see {Operator =~}[rdoc-ref:Regexp@Operator-]. The affected global variables are: @@ -561,9 +561,9 @@ Quantifier matching may be greedy, lazy, or possessive: More: - About greedy and lazy matching, see - {Choosing Minimal or Maximal Repetition}[https://doc.lagout.org/programmation/Regular%20Expressions/Regular%20Expressions%20Cookbook_%20Detailed%20Solutions%20in%20Eight%20Programming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-09-06%5D.pdf#tutorial-backtrack]. + {Choosing Minimal or Maximal Repetition}[https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch02s13.html]. - About possessive matching, see - {Eliminate Needless Backtracking}[https://doc.lagout.org/programmation/Regular%20Expressions/Regular%20Expressions%20Cookbook_%20Detailed%20Solutions%20in%20Eight%20Programming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-09-06%5D.pdf#tutorial-backtrack]. + {Eliminate Needless Backtracking}[https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch02s14.html]. === Groups and Captures @@ -764,7 +764,7 @@ The pattern: 9. Matches the fourth character in the string, ')'. 10. Matches the end of the string. -See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings-and-backreferences.html?highlight=subexpression#subexpression-calls]. +See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings-and-backreferences.html#subexpression-calls]. ==== Conditionals diff --git a/object.c b/object.c index a7b72196d59fb8..24202f069eacb0 100644 --- a/object.c +++ b/object.c @@ -1913,26 +1913,27 @@ rb_mod_eqq(VALUE mod, VALUE arg) /* * call-seq: - * mod <= other -> true, false, or nil + * self <= other -> true, false, or nil * - * Returns +true+ if +self+ is a descendant of +other+ - * (+self+ is a subclass of +other+ or +self+ includes +other+) or - * if +self+ is the same as +other+: + * Compares +self+ and +other+ with respect to ancestry and inclusion. * - * Float <= Numeric # => true - * Array <= Enumerable # => true - * Float <= Float # => true + * Returns +nil+ if there is no such relationship between the two: * - * Returns +false+ if +self+ is an ancestor of +other+ - * (+self+ is a superclass of +other+ or +self+ is included in +other+): + * Array <= Hash # => nil * - * Numeric <= Float # => false - * Enumerable <= Array # => false + * Otherwise, returns +true+ if +other+ is an ancestor of +self+, + * or if +self+ includes +other+, + * or if the two are the same: * - * Returns +nil+ if there is no relationship between the two: + * File <= IO # => true # IO is an ancestor of File. + * Array <= Enumerable # => true # Array includes Enumerable. + * Array <= Array # => true + * + * Otherwise, returns +false+: + * + * IO <= File # => false + * Enumerable <= Array # => false * - * Float <= Hash # => nil - * Enumerable <= String # => nil */ VALUE @@ -2011,7 +2012,9 @@ rb_mod_lt(VALUE mod, VALUE arg) /* * call-seq: - * mod >= other -> true, false, or nil + * self >= other -> true, false, or nil + * + * Compares +self+ and +other+ with respect to ancestry and inclusion. * * Returns +true+ if +self+ is an ancestor of +other+ * (+self+ is a superclass of +other+ or +self+ is included in +other+) or