diff options
Diffstat (limited to 'array.c')
| -rw-r--r-- | array.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -3067,6 +3067,8 @@ rb_ary_nitems(ary) long n = 0; VALUE *p, *pend; + rb_warn("Array#nitems is deprecated; use Array#count { |i| !i.nil? }"); + for (p = RARRAY(ary)->ptr, pend = p + RARRAY(ary)->len; p < pend; p++) { if (!NIL_P(*p)) n++; } @@ -3363,6 +3365,8 @@ rb_ary_choice(ary) { long i, j; + rb_warn("Array#choice is deprecated; use Array#sample"); + i = RARRAY(ary)->len; if (i == 0) return Qnil; j = rb_genrand_real()*i; |
