From: serialhex Date: 2010-12-28T10:57:14+09:00 Subject: Re: Numeric comparison with nil - Math masochists only!! --20cf30549de366070504986ec5de Content-Type: text/plain; charset=ISO-8859-1 hey robert, thanks for the great article, i'll keep that stuff in mind as i'm writing the rest of this class! hex On Mon, Dec 27, 2010 at 5:46 AM, Robert Klemme wrote: > On Sat, Dec 25, 2010 at 2:34 AM, serialhex wrote: > > Colin, your amazing insight has led me to programming greatness!!! > > > > ...ok, mabye not so much, but i have (mostly) solved the problem using > the > > Delegate class, heres the relevant code: > > > > ## > > require 'delegate' > > > > class SurrealNil < DelegateClass(NilClass) > > include Comparable > > def <=> other > > return -1 > > end > > def initialize > > super nil > > end > > end > > ## > > > > it returns -1 all the time so no matter what you compare it against it's > > less than that (i mean, sereously, an empty set is WAAAAYYYYYYY less than > > neg infinity, cause with neg infinity you still have SOMETHING right?) > > > > so while the rest of the project is FAR from finished, at least this part > is > > completed. thanks for the help!! > > If you need additional input I have written about numeric classes in our > blog > > http://blog.rubybestpractices.com/posts/rklemme/019-Complete_Numeric_Class.html > > Kind regards > > robert > > -- > remember.guy do |as, often| as.you_can - without end > http://blog.rubybestpractices.com/ > > --20cf30549de366070504986ec5de--