From 9d6dd89400847790875e7a60085530817dfb5541 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 16 Feb 2014 16:59:09 +0000 Subject: merge revision(s) r44549: [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_0_0@45013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- range.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'range.c') diff --git a/range.c b/range.c index e2e8388c43..cea90140d9 100644 --- a/range.c +++ b/range.c @@ -696,9 +696,12 @@ sym_each_i(VALUE v, void *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 -- cgit v1.2.3