From: Daniel Finnie Date: 2007-02-21T08:53:44+09:00 Subject: Re: [Facets] Range#overlap? Which is, IMHO, correct: >> (4..8).include? 8.5 => false >> (6...9).include? 8.5 => true Dan Daniel Schierbeck wrote: > On Wed, 2007-02-21 at 08:00 +0900, Daniel Finnie wrote: >> I think your implementation is cleaner however the endpoints of a Range >> do not have to implement #succ. >> >> class Range >> def span? other >> include? other.first and >> (other.exclude_end? ? other.last < last : other.last <= last ) >> end >> end > > I've tried that implementation, but i doesn't work if you consider this > valid: > > (4..8).span? 6...9 > > Since 6...9 yields the same values as 6..8. Or am I wrong to expect the > above? > > I know #last doesn't have to support #succ, and I'd be happy to see a > better implementation. Challenge? ;) > > > Cheers, > Daniel > > >