summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdette Lamar <BurdetteLamar@Yahoo.com>2025-04-02 11:03:17 -0500
committerGitHub <noreply@github.com>2025-04-02 12:03:17 -0400
commit2a55cc3fb87f43b44dfb820f325bed60f01db236 (patch)
tree2695516d0b7ad9cc398820163173e26badd696b6
parentce1dfe81c2ef148aa6f0f2bb51ee373f68cefd04 (diff)
[DOC] Tweaks to String::try_convert
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13030 Merged-By: peterzhu2118 <peter@peterzhu.ca>
-rw-r--r--string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/string.c b/string.c
index 857d1e1085..abb099eda1 100644
--- a/string.c
+++ b/string.c
@@ -2874,14 +2874,16 @@ rb_check_string_type(VALUE str)
* call-seq:
* String.try_convert(object) -> object, new_string, or nil
*
- * If +object+ is a +String+ object, returns +object+.
+ * Attempts to convert the given +object+ to a string.
+ *
+ * If +object+ is already a string, returns +object+, unmodified.
*
* Otherwise if +object+ responds to <tt>:to_str</tt>,
* calls <tt>object.to_str</tt> and returns the result.
*
* Returns +nil+ if +object+ does not respond to <tt>:to_str</tt>.
*
- * Raises an exception unless <tt>object.to_str</tt> returns a +String+ object.
+ * Raises an exception unless <tt>object.to_str</tt> returns a string.
*/
static VALUE
rb_str_s_try_convert(VALUE dummy, VALUE str)