From: Robert Klemme Date: 2003-11-25T23:52:11+09:00 Subject: Re: raise unless RUBY_VERSION[%r/^\s*\d+\.\d+/o].to_f >= 1.8 "T. Onoma" schrieb im Newsbeitrag news:200311250344.18704.transami@runbox.com... > On Tuesday 25 November 2003 11:22 am, Robert Klemme wrote: > > Nothing easier than that. You can do > > > > module Kernel > > def Tuple(*a) > > a = a[0] if a.size == 1 and a[0].kind_of? Enumerable > > a = a.to_a unless a.kind_of? Array > > a.extend Comparable > > end > > end > > > > t1 = Tuple( [1,2,3] ) > > t2 = Tuple( 1, 3, 4 ) > > > > p t1 < t2 > > Nice! > > Could string be added too? So that: > > t = Tuple('1.8.1') > rv = Tuple(RUBY_VERSION) > > That would be really sweet. I'll have to add this to my stash of libraries. :) Exercise left for the reader. :-) robert