From: "Ara.T.Howard" Date: 2003-11-28T01:52:14+09:00 Subject: Re: raise unless RUBY_VERSION[%r/^\s*\d+\.\d+/o].to_f >= 1.8 On Thu, 27 Nov 2003, T. Onoma wrote: > Date: Thu, 27 Nov 2003 14:59:58 +0900 > From: T. Onoma > Newsgroups: comp.lang.ruby > Subject: Re: raise unless RUBY_VERSION[%r/^\s*\d+\.\d+/o].to_f >= 1.8 > > On Thursday 27 November 2003 12:12 am, Ara.T.Howard wrote: > > On Thu, 27 Nov 2003, Paul Brannan wrote: > > > Date: Thu, 27 Nov 2003 06:40:52 +0900 > > > From: Paul Brannan > > > Newsgroups: comp.lang.ruby > > > Subject: Re: raise unless RUBY_VERSION[%r/^\s*\d+\.\d+/o].to_f >= 1.8 > > > > > > On Tue, Nov 25, 2003 at 08:32:14AM +0900, Ara.T.Howard wrote: > > > > any better methods of require a specific version/set of versions? > > > > > > require 'rbconfig' > > > > > > major = Config::CONFIG['MAJOR'].to_i > > > minor = Config::CONFIG['MINOR'].to_i > > > teeny = Config::CONFIG['TEENY'].to_i > > > if major < 1 or (major == 1 and minor < 8) then > > > raise "wrong version" > > > end > > > > > > Of course, this can be wrapped into a nice version class. I wrote one > > > of these a long time ago and never released it, but there are plenty of > > > others already out there. > > > > > > Paul > > > > nice! you win paul! > > not knocking paul's solution or anything, but you prefer this to using a > tuple? yes. one thing i had not yet mentioned is that i also may want to incorporate the semantics of version. for instance, with libtool type versioning, the following are compatible versions: 7.6.10 2.0.7 this is because, with libtool, the revision's meaning is revision.age.impl (see the libtool docs for more) because revision 7 spans 6 ages, it is compatible with all versions 1 - 7. i don't know what ruby's major, minor, teeny numbers mean but would like to do something similar if possible. and using them in paul's way would make the intent very clear. -a -- ATTN: please update your address books with address below! =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | STP :: http://www.ngdc.noaa.gov/stp/ | NGDC :: http://www.ngdc.noaa.gov/ | NESDIS :: http://www.nesdis.noaa.gov/ | NOAA :: http://www.noaa.gov/ | US DOC :: http://www.commerce.gov/ | | The difference between art and science is that science is what we | understand well enough to explain to a computer. | Art is everything else. | -- Donald Knuth, "Discover" | | /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' ===============================================================================