method
any?
v2_5_5 -
Show latest stable
- Class:
Array
any?(*args)public
See also Enumerable#any?
static VALUE
rb_ary_any_p(int argc, VALUE *argv, VALUE ary)
{
long i, len = RARRAY_LEN(ary);
const VALUE *ptr = RARRAY_CONST_PTR(ary);
rb_check_arity(argc, 0, 1);
if (!len) return Qfalse;
if (argc) {
for (i = 0; i < RARRAY_LEN(ary); ++i) {
if (RTEST(rb_funcall(argv[0], idEqq, 1, RARRAY_AREF(ary, i)))) return Qtrue;
}
}
else if (!rb_block_given_p()) {
for (i = 0; i < len; ++i) if (RTEST(ptr[i])) return Qtrue;
}
else {
for (i = 0; i < RARRAY_LEN(ary); ++i) {
if (RTEST(rb_yield(RARRAY_AREF(ary, i)))) return Qtrue;
}
}
return Qfalse;
} Related methods
- Instance methods
- &
- *
- +
- -
- <<
- <=>
- ==
- []
- []=
- abbrev
- any?
- append
- assoc
- at
- bsearch
- bsearch_index
- clear
- collect
- collect!
- combination
- compact
- compact!
- concat
- count
- cycle
- dclone
- delete
- delete_at
- delete_if
- dig
- drop
- drop_while
- each
- each_index
- empty?
- eql?
- fetch
- fill
- find_index
- first
- flatten
- flatten!
- frozen?
- hash
- include?
- index
- initialize_copy
- insert
- inspect
- join
- keep_if
- last
- length
- map
- map!
- max
- min
- pack
- permutation
- pop
- prepend
- pretty_print
- pretty_print_cycle
- product
- push
- rassoc
- reject
- reject!
- repeated_combination
- repeated_permutation
- replace
- reverse
- reverse!
- reverse_each
- rindex
- rotate
- rotate!
- sample
- select
- select!
- shelljoin
- shift
- shuffle
- shuffle!
- size
- slice
- slice!
- sort
- sort!
- sort_by!
- sum
- take
- take_while
- to_a
- to_ary
- to_csv
- to_h
- to_s
- transpose
- uniq
- uniq!
- unshift
- values_at
- zip
- |
- Class methods
- []
- new
- try_convert