summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2025-11-13 14:07:08 +0000
committerPeter Zhu <peter@peterzhu.ca>2025-11-13 18:27:43 -0800
commit6c7453c5deb76c0be336cedd5eba667e0b6629c6 (patch)
tree0902cd577e6b9101c6bfd23928f78b6869f31a46 /string.c
parent7ea0d369661f9050d29e4a37899cafc8c03d5497 (diff)
[DOC] Tweaks for String#tr_s
Diffstat (limited to 'string.c')
-rw-r--r--string.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/string.c b/string.c
index 2a81a68ad9..b78dba7d83 100644
--- a/string.c
+++ b/string.c
@@ -8964,16 +8964,21 @@ rb_str_tr_s_bang(VALUE str, VALUE src, VALUE repl)
/*
* call-seq:
- * tr_s(selector, replacements) -> string
+ * tr_s(selector, replacements) -> new_string
*
- * Like String#tr, but also squeezes the modified portions of the translated string;
- * returns a new string (translated and squeezed).
+ * Like String#tr, except:
+ *
+ * - Also squeezes the modified portions of the translated string;
+ * see String#squeeze.
+ * - Returns the translated and squeezed string.
+ *
+ * Examples:
*
* 'hello'.tr_s('l', 'r') #=> "hero"
* 'hello'.tr_s('el', '-') #=> "h-o"
* 'hello'.tr_s('el', 'hx') #=> "hhxo"
*
- * Related: String#squeeze.
+ * Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
*
*/