summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorzverok <zverok.offline@gmail.com>2023-02-15 21:38:23 +0200
committerVictor Shepelev <zverok.offline@gmail.com>2023-02-19 22:32:52 +0200
commit51bb5b23d499b02b670c9764fd1d51ef02d01c0a (patch)
tree455b0f73d10408fdb3cdccca94b701ab346a899f /string.c
parent0c0b9191ce96413258e8124bb4661ddae60cdf7a (diff)
downloadruby-51bb5b23d499b02b670c9764fd1d51ef02d01c0a.tar.gz
[DOC] Small adjustment for String method docs
* Hide freeze method (no useful docs, same as Object#freeze) * Add dedup to call-seq of str_uminus
Diffstat (limited to 'string.c')
-rw-r--r--string.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/string.c b/string.c
index 38a26022f9..113265a8f9 100644
--- a/string.c
+++ b/string.c
@@ -2950,6 +2950,7 @@ str_substr(VALUE str, long beg, long len, int empty)
return str2;
}
+/* :nodoc: */
VALUE
rb_str_freeze(VALUE str)
{
@@ -2981,13 +2982,24 @@ str_uplus(VALUE str)
/*
* call-seq:
* -string -> frozen_string
+ * dedup -> frozen_string
*
* Returns a frozen, possibly pre-existing copy of the string.
*
* 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.
*
- * String#dedup is an alias for String#-@.
+ * Note that <tt>-string</tt> variant is more convenient for defining
+ * constants:
+ *
+ * FILENAME = -'config/database.yml'
+ *
+ * while +dedup+ is better suitable for using the method in chains
+ * of calculations:
+ *
+ *
+ * @url_list.concat(urls.map(&:dedup))
+ *
*/
static VALUE
str_uminus(VALUE str)