From: Jim Weirich Date: 2006-03-25T06:12:04+09:00 Subject: Re: require a certain version of the ruby interpreter Shea Martin wrote: > I would like to enforce ruby 1.8.4 or higher. > > if VERSION < "1.8.4" > raise "Invalid version" > end > > Fails when VERSION is "1.8.10". > > Yeah, I know I could write my own string comparison, but was wondering > if there is a canned solution for this? if Gem::Version.new(VERSION) < Gem::Version.new("1.8.4") raise "Invalid Version" end Or, if you want to get fancy, you could specify any version greater than or equal to 1.8.4, but less than 1.9. r = Gem::Requirement.new("~> 1.8.4") unless r.satisfied_by?(Gem::Version(VERSION)) raise "Invalid version, must be #{r}" end Just make sure that rubygems is loaded to use this. -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.