I need to tell if an array contains all of the elements of another array with duplicates.
[1,2,3].contains_all? [1,2] #=> true [1,2,3].contains_all
class Array def contains_all? other other = other.dup each{|e| if i = other.index(e) then other.delete_at(i) end} other.empty? end end