merge revision(s) 44549: [Backport #9387]

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2014-02-22 06:16:18 +00:00
parent a9a6a643f8
commit f1161c9384
3 changed files with 10 additions and 2 deletions

View file

@ -711,9 +711,12 @@ sym_each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
* 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