summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdette Lamar <BurdetteLamar@Yahoo.com>2025-01-29 09:16:47 -0600
committerGitHub <noreply@github.com>2025-01-29 10:16:47 -0500
commitd3bb42776c4232c51729c77da91c127e79468b27 (patch)
tree8c24f2838587ab240b2fcad3424e25105ab4d96a
parent63b6323e049ccab4ea5ecc716a2be61b8e6b4c3b (diff)
[DOC] Tweaks for rb_hash_s_try_convert
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12632 Merged-By: peterzhu2118 <peter@peterzhu.ca>
-rw-r--r--hash.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/hash.c b/hash.c
index 4a0ca58c1e..dd11aa811b 100644
--- a/hash.c
+++ b/hash.c
@@ -1902,16 +1902,15 @@ rb_check_hash_type(VALUE hash)
/*
* call-seq:
- * Hash.try_convert(obj) -> obj, new_hash, or nil
+ * Hash.try_convert(object) -> object, new_hash, or nil
*
- * If +obj+ is a +Hash+ object, returns +obj+.
+ * If +object+ is a hash, returns +object+.
*
- * Otherwise if +obj+ responds to <tt>:to_hash</tt>,
- * calls <tt>obj.to_hash</tt> and returns the result.
+ * Otherwise if +object+ responds to +:to_hash+,
+ * calls <tt>object.to_hash</tt>;
+ * returns the result if it is a hash, or raises TypeError if not.
*
- * Returns +nil+ if +obj+ does not respond to <tt>:to_hash</tt>
- *
- * Raises an exception unless <tt>obj.to_hash</tt> returns a +Hash+ object.
+ * Otherwise if +object+ does not respond to +:to_hash+, returns +nil+.
*/
static VALUE
rb_hash_s_try_convert(VALUE dummy, VALUE hash)