From: Robert Klemme Date: 2006-08-03T18:30:09+09:00 Subject: Re: A left-exclusive Range class Cyrus Hall wrote: > On Thu, 2006-08-03 at 01:35 +0900, Robert Klemme wrote: >> The simplest thing you can always do is to create a method that (and >> optionally a special range class if you like) implements this as syntax >> modifications are always difficult. If you do >> >> module Kernel >> private >> >> def lor(r) >> r.exclude_end? ? r.first.succ ... r.last : r.first.succ .. r.last >> end >> end > > This isn't quite right however, as lor(0...10).include?(0.5) would > return false (when it should return true). However, what you suggest is > what I'm doing right now, as every DHT I've ever seen uses whole > numbers. Never the less, looking for a better solution... Yeah, that was just a quick sample hack to illustrate the idea. > I'm writing the unit tests for a little replacement class right now. > Once they all pass, I'll post it for others. As I see you got the hang of it already. :-) Cheers robert