summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-27 17:28:41 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-27 17:28:41 +0000
commitefee3033b5ab03b4d4562c678e7a2feac8a110a9 (patch)
tree632dcae9b80499d7ed9d21161c9eb7e0497600ad
parentecf4641b4cc3301f45415367d3b425f2b832e681 (diff)
Include Hash#size in the examples
Both methods Hash#length and Hash#size share the same source code in Ruby, but they also share the same documentation. Now when you look at the documentation of Hash#size you only see examples for Hash#length, which is confusing. This commit includes Hash#size in the examples and also remarks that both methods are equivalent to each other. Co-authored-by: Alberto Almagro <alberto.almagro@rakuten.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--hash.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 48fbe1f37c..c457923ddf 100644
--- a/hash.c
+++ b/hash.c
@@ -1731,11 +1731,15 @@ rb_hash_replace(VALUE hash, VALUE hash2)
* hsh.size -> integer
*
* Returns the number of key-value pairs in the hash.
+ * <code>Hash#length</code> and <code>Hash#size</code> are both equivalent to
+ * each other.
*
* h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
* h.length #=> 4
+ * h.size #=> 4
* h.delete("a") #=> 200
* h.length #=> 3
+ * h.size #=> 3
*/
VALUE