Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Arrayクラス > any?
any? -> bool
[permalink][rdoc]any? {|item| ... } -> bool
すべての要素が偽である場合に false を返します。真である要素があれば、ただちに true を返します。
ブロックを伴う場合は、各要素に対してブロックを評価し、すべての結果が偽である場合に false を返します。ブロックが真を返した時点で、ただちに true を返します。
要素の数が 0 である配列に対しては false を返します。
p [1, 2, 3].any? {|v| v > 3 } # => false
p [1, 2, 3].any? {|v| v > 1 } # => true
p [].any? {|v| v > 0 } # => false
[SEE_ALSO] Enumerable#any?