From: Intransition Date: 2010-04-11T08:31:46+09:00 Subject: Re: Detect if 2 ranges share elements On Apr 10, 7:13 pm, Derek Cannon wrote: > 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? > > For example: > > [1..10] and  [9..15] => false (they share common elements) > [1..10] and [11..20] => true (they are both unique) Checkout Facets' Range#overlap >> require 'facets/range/overlap' => true >> (1..10).overlap?(9..15) => true >> (1..10).overlap?(11..20) => false