From: Tim Bates Date: 2004-11-16T08:13:50+09:00 Subject: Re: "The Ruby Way" and adding methods to base classes in libraries Joel VanderWerf wrote: >> So, what's the right way to handle this situation? > > > You could define this method in a module and use Object#extend to give > that functionality to particular arrays. The other way to deal with this would be to create a new class that inherits from Array: class SuperSetArray < Array # or some other, better name def first_superset_of(*arrays) arrays.detect do |array| self.detect do |element| not array.include?(element) ? false : true end end end end Tim. -- Tim Bates tim@bates.id.au