I have a multidimensional array like:
arr1 = [["text1", 1], ["text2", 2], [" text3", 3], [" text4", 4], ["text5", 5], ["text6", 6], ["text7", 7]]
and another
arr2 = [2,3,6]
I want to extract entire array if it contains elements of arr2. So, result should be:
arr = [["text2", 2], [" text3", 3], ["text6", 6]].
I've tried many ways but unable to get the result. Attempts such as:
arr1.each { |elem| arr2.each { |x| elem.delete_if{ |u| elem.include?(x) } } }
and
arr2.map { |x| arr1.map{|key, val| val.include?(x) }}
Can anyone please help?