From 51bb5b23d499b02b670c9764fd1d51ef02d01c0a Mon Sep 17 00:00:00 2001 From: zverok Date: Wed, 15 Feb 2023 21:38:23 +0200 Subject: [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 --- string.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'string.c') 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 -string 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) -- cgit v1.2.1