Skip to content

Commit 88764dd

Browse files
committed
[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.
1 parent 2a0006c commit 88764dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/ruby/internal/symbol.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ ID rb_to_id(VALUE str);
202202
VALUE rb_id2str(ID id);
203203

204204
/**
205-
* Identical to rb_id2str(), except it takes an instance of ::rb_cSymbol rather
206-
* than an ::ID.
205+
* Obtain a frozen string representation of a symbol (not including the leading
206+
* colon). Done without any object allcoations.
207207
*
208-
* @param[in] id An id to query.
209-
* @retval RUBY_Qfalse No such id ever existed in the history.
210-
* @retval otherwise An instance of ::rb_cString with the name of id.
208+
* @param[in] symbol A ::rb_cSymbol instance to query.
209+
* @return A frozen instance of ::rb_cString with the name of `symbol`.
210+
* @note This does not create a permanent ::ID using the symbol.
211211
*/
212-
VALUE rb_sym2str(VALUE id);
212+
VALUE rb_sym2str(VALUE symbol);
213213

214214
/**
215215
* Identical to rb_intern_str(), except it generates a dynamic symbol if

0 commit comments

Comments
 (0)