> class Array
> def contains?(array)
> (self & array) == array
> end
> end
Note however, this will only work if the match is in order.
For example
[1,2,3,4].contains?([2,1]) #=> false
But
[1,2,3,4].contains?([1,4]) #=> true
That might be what you want. If not, you could call sort on it as well.
ANyway... the point is, you can have a look at the ruby rdoc and find
a lot about this. Arrays have been around for a while and Ruby
handles them more elegantly than any other language I have used.
Go have a read:
http://www.ruby-doc.org/core/classes/Array.html
Mikel
--
http://lindsaar.net/
Rails, RSpec and Life blog....