On Thu, 27 Nov 2003, Paul Brannan wrote: > Date: Thu, 27 Nov 2003 06:40:52 +0900 > From: Paul Brannan <pbrannan / atdesk.com> > 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! -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' ===============================================================================