[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
This commit is contained in:
zverok 2023-02-15 21:38:23 +02:00 committed by Victor Shepelev
parent 0c0b9191ce
commit 51bb5b23d4
Notes: git 2023-02-19 20:33:15 +00:00

View File

@ -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)