method
empty?

Register or
log in
to add new notes.
szeryf -
June 25, 2009

2 thanks
Antonym of empty?
The antonym of empty? is Enumerable#any? method:
[].empty? #=> true [].any? #=> false [1].empty? #=> false [1].any? #=> true
Be cautious however, if your array might contain nil’s or false’s:
[false, nil].any? #=> false