[Nitro] [NP.ORG] Nitro/Og Fora daily digest

Jan Mikkelsen janm-nitro at transactionware.com
Mon May 21 22:20:50 EDT 2007


Jan Mikkelsen wrote:
 > [ Slightly broken Ruby elided ]

Gee, I shouldn't write off-the-cuff Ruby with my head fully loaded with 
C++.  Let's try that again:

class Date
      include Comparable

      attr :val

      def initialize(t)
          @val = [ t.year, t.month, t.day ]
      end

      def <=>(other)
          @val <=> other.val
      end
end

if Date.new(t1) == Date.new(t2)
	...
elsif Date.new(t1) < Date.new(t2)
	...
end

Anyway, you get the idea!

Regards,

Jan Mikkelsen


More information about the Nitro-general mailing list