diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-27 17:28:41 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-27 17:28:41 +0000 |
commit | efee3033b5ab03b4d4562c678e7a2feac8a110a9 (patch) | |
tree | 632dcae9b80499d7ed9d21161c9eb7e0497600ad /hash.c | |
parent | ecf4641b4cc3301f45415367d3b425f2b832e681 (diff) | |
download | ruby-efee3033b5ab03b4d4562c678e7a2feac8a110a9.tar.gz |
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
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 |