From: danfinnie@... Date: 2007-02-20T10:56:21+09:00 Subject: Re: [Facets] Range#overlap? I think that overlap? and within? are two different things, which I'm not sure you think from your email. Overlap? suggests, to me, that a subset of the things one range includes is the same as a subset of things that the other range includes. Within? suggests that all of one range is contained in a subset of the other range. Otherwise, I do like both names and your implementation. ----- Original Message ----- From: Daniel Schierbeck Date: Monday, February 19, 2007 7:08 pm Subject: [Facets] Range#overlap? To: ruby-talk@ruby-lang.org (ruby-talk ML) > (I'm sending this to the list because I think it has general interest.
> Sorry if you disagree!) > > Hi T. and the rest of you, > > I was discussing[1] a method that tested whether one range overlaps > another, and noticed that Facets has a somewhat funny implementation > called #within?. I came up with this: > > class Range > def overlap? other > include? other.first or other.include? first > end > end > > It would seem to be simpler, and I really like the method name. > Can you > see any errors? Feel free to add it to Facets if you wish to. > > > Cheers, > Daniel > > > 1. http://opensoul.org/2007/2/13/ranges-include-or-overlap-with- > ranges > >