SyntaxFix
Write A Post
Hire A Developer
Questions
If there are are no duplicate elements or you don't care about them, then you can use the Set class:
a1 = Set.new [5, 1, 6, 14, 2, 8] a2 = Set.new [2, 6, 15] a1.subset?(a2) => false
Behind the scenes this uses
all? { |o| set.include?(o) }