intersect?(other) -> boolRuby 3.1 から[permalink][rdoc][edit]-
other と共通の要素が少なくとも1個あれば true を、なければ false を返します。
例a = [ 1, 2, 3 ] b = [ 3, 4, 5 ] c = [ 5, 6, 7 ] p a.intersect?(b) # => true p a.intersect?(c) # => false
このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ
intersect?(other) -> boolRuby 3.1 から[permalink][rdoc][edit]other と共通の要素が少なくとも1個あれば true を、なければ false を返します。
例a = [ 1, 2, 3 ]
b = [ 3, 4, 5 ]
c = [ 5, 6, 7 ]
p a.intersect?(b) # => true
p a.intersect?(c) # => false