diff options
author | zverok <[email protected]> | 2023-02-15 21:38:23 +0200 |
---|---|---|
committer | Victor Shepelev <[email protected]> | 2023-02-19 22:32:52 +0200 |
commit | 51bb5b23d499b02b670c9764fd1d51ef02d01c0a (patch) | |
tree | 455b0f73d10408fdb3cdccca94b701ab346a899f /string.c | |
parent | 0c0b9191ce96413258e8124bb4661ddae60cdf7a (diff) |
[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
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7316
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) |