From: Jean-Julien Fleck Date: 2010-04-11T08:33:52+09:00 Subject: Re: Detect if 2 ranges share elements Hello Derek 2010/4/11 Derek Cannon : > Probably a simple problem for most of you out there: > > What is the best way to make sure two ranges don't share any elements? I don't know if it's the best but it should be working at least def have_common?(r1,r2) arr = r1.to_a & r2.to_a !arr.empty? end have_common?(1..10,9..15) have_common?(1..10,11..20) Cheers, -- JJ Fleck PCSI1 Lycée Kléber