summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/array.c b/array.c
index d063b06bd6..14edc9bad9 100644
--- a/array.c
+++ b/array.c
@@ -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;