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

ruby-changes:32470

From: eregon <ko1@a...>
Date: Fri, 10 Jan 2014 06:23:51 +0900 (JST)
Subject: [ruby-changes:32470] eregon:r44549 (trunk): * range.c (Range#size): [DOC] improve description and add examples.

eregon	2014-01-10 06:23:45 +0900 (Fri, 10 Jan 2014)

  New Revision: 44549

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44549

  Log:
    * range.c (Range#size): [DOC] improve description and add examples.
      Patch by @skade. [Fixes GH-501]

  Modified files:
    trunk/ChangeLog
    trunk/range.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44548)
+++ ChangeLog	(revision 44549)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jan 10 06:23:21 2014  Benoit Daloze  <eregontp@g...>
+
+	* range.c (Range#size): [DOC] improve description and add examples.
+	  Patch by @skade. [Fixes GH-501]
+
 Fri Jan 10 00:47:52 2014  Josef Stribny  <strzibny@g...>
 
 	* ext/tk/extconf.rb: fix to pass arrays instead of strings to
Index: range.c
===================================================================
--- range.c	(revision 44548)
+++ range.c	(revision 44549)
@@ -711,9 +711,12 @@ sym_each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, https://github.com/ruby/ruby/blob/trunk/range.c#L711
  *  call-seq:
  *     rng.size                   -> num
  *
- *  Returns the number of elements in the range.
+ *  Returns the number of elements in the range. Both the begin and the end of
+ *  the Range must be Numeric, otherwise nil is returned.
  *
  *    (10..20).size    #=> 11
+ *    ('a'..'z').size  #=> nil
+ *    (-Float::INFINITY..Float::INFINITY).size #=> Infinity
  */
 
 static VALUE

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

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