diff options
author | Alan Wu <[email protected]> | 2024-11-29 18:33:44 -0500 |
---|---|---|
committer | Alan Wu <[email protected]> | 2024-11-29 18:33:44 -0500 |
commit | 88764dde78ee3475cd61447e45945a6569e8d639 (patch) | |
tree | b0b5567f35365e391724d452ca1c9b523ce888cd /include/ruby/internal | |
parent | 2a0006c10102e544d18767f17eff3c8301c14959 (diff) |
[DOC] Rewrite docs for rb_sym2str()
Explaining this by reference to rb_id2str() obscures a few important
details because IDs and symbols don't map to each other perfectly (you
can have a dynamic symbol without an ID!) Also, it used to take 2
redirections to get to concrete information, and I think being more
direct is friendlier.
Diffstat (limited to 'include/ruby/internal')
-rw-r--r-- | include/ruby/internal/symbol.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/ruby/internal/symbol.h b/include/ruby/internal/symbol.h index ac11a2c813..7371d32408 100644 --- a/include/ruby/internal/symbol.h +++ b/include/ruby/internal/symbol.h @@ -202,14 +202,14 @@ ID rb_to_id(VALUE str); VALUE rb_id2str(ID id); /** - * Identical to rb_id2str(), except it takes an instance of ::rb_cSymbol rather - * than an ::ID. + * Obtain a frozen string representation of a symbol (not including the leading + * colon). Done without any object allcoations. * - * @param[in] id An id to query. - * @retval RUBY_Qfalse No such id ever existed in the history. - * @retval otherwise An instance of ::rb_cString with the name of id. + * @param[in] symbol A ::rb_cSymbol instance to query. + * @return A frozen instance of ::rb_cString with the name of `symbol`. + * @note This does not create a permanent ::ID using the symbol. */ -VALUE rb_sym2str(VALUE id); +VALUE rb_sym2str(VALUE symbol); /** * Identical to rb_intern_str(), except it generates a dynamic symbol if |