From 3ea6ec8344a07e2d10ba248c69039dd4d27fd8fb Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Wed, 7 Jan 2026 17:02:22 -0600 Subject: [DOC] Harmonize #=~ methods (#15814) --- string.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 234ef1edc8..6f4ea03fb3 100644 --- a/string.c +++ b/string.c @@ -5011,12 +5011,15 @@ rb_str_byterindex_m(int argc, VALUE *argv, VALUE str) /* * call-seq: - * self =~ object -> integer or nil + * self =~ other -> integer or nil * - * When +object+ is a Regexp, returns the index of the first substring in +self+ - * matched by +object+, - * or +nil+ if no match is found; - * updates {Regexp-related global variables}[rdoc-ref:Regexp@Global+Variables]: + * When +other+ is a Regexp: + * + * - Returns the integer index (in characters) of the first match + * for +self+ and +other+, or +nil+ if none; + * - Updates {Regexp-related global variables}[rdoc-ref:Regexp@Global+Variables]. + * + * Examples: * * 'foo' =~ /f/ # => 0 * $~ # => # @@ -5034,8 +5037,8 @@ rb_str_byterindex_m(int argc, VALUE *argv, VALUE str) * /(?\d+)/ =~ 'no. 9' # => 4 * number # => "9" # Assigned. * - * If +object+ is not a Regexp, returns the value - * returned by object =~ self. + * When +other+ is not a Regexp, returns the value + * returned by other =~ self. * * Related: see {Querying}[rdoc-ref:String@Querying]. */ @@ -12445,9 +12448,9 @@ sym_casecmp_p(VALUE sym, VALUE other) /* * call-seq: - * symbol =~ object -> integer or nil + * self =~ other -> integer or nil * - * Equivalent to symbol.to_s =~ object, + * Equivalent to self.to_s =~ other, * including possible updates to global variables; * see String#=~. * -- cgit v1.2.3