From: "Sandor Szücs" Date: 2008-07-07T15:32:10+09:00 Subject: Re: Find matching elements in array On 07.07.2008, at 08:04, Pragash Mr. wrote: > I have one array for example[1,2,3,4] > > i need to find the matching elements of another array is there any way > to find.... > for example [1,2,3,4].include?(2) > it will return true > but i need to find one or more elements > example : [1,2,3,4].include?(2,3) > it is throwing an error > > > > If you have solution reply me class Array alias old_include? include? def include?(*args) if args.length <= 1 old_include?(args) else args.all? do |a| old_include?(a) end end end end puts("#{(0..9).to_a.include?(3,5)}") # true puts("#{('a'..'z').to_a.include?(3,5)}") # false puts("#{('A'..'ZZ').to_a.include?('G','AB')}")# true regards, Sandor Szücs --