[前][次][番号順一覧][スレッド一覧]

ruby-changes:52824

From: stomar <ko1@a...>
Date: Sat, 13 Oct 2018 04:57:00 +0900 (JST)
Subject: [ruby-changes:52824] stomar:r65036 (trunk): hash.c: improve docs for Hash#{size, length}

stomar	2018-10-13 04:56:53 +0900 (Sat, 13 Oct 2018)

  New Revision: 65036

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65036

  Log:
    hash.c: improve docs for Hash#{size,length}
    
    * hash.c: [DOC] shorten example code for Hash#{size,length}
      and mention aliases at the end; also enable links.

  Modified files:
    trunk/hash.c
Index: hash.c
===================================================================
--- hash.c	(revision 65035)
+++ hash.c	(revision 65036)
@@ -1731,15 +1731,14 @@ rb_hash_replace(VALUE hash, VALUE hash2) https://github.com/ruby/ruby/blob/trunk/hash.c#L1731
  *     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
+ *     h.length        #=> 3
+ *
+ *  Hash#length is an alias for Hash#size.
  */
 
 VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]