From: ara.t.howard@... Date: 2006-03-25T06:28:12+09:00 Subject: Re: require a certain version of the ruby interpreter On Sat, 25 Mar 2006, 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? fyi. it's largely a waste of time harp:~ > cat a.rb abort "require 1.8.4" unless RUBY_VERSION == "1.8.4" puts ["inject is not in 1.6.8"].inject(""){|s,phrase| s << phrase} harp:~ > ruby -v ruby 1.8.4 (2006-01-12) [i686-linux] harp:~ > ruby a.rb inject is not in 1.6.8 harp:~ > /usr/bin/ruby -v ruby 1.6.8 (2002-12-24) [i386-linux-gnu] harp:~ > /usr/bin/ruby a.rb a.rb:1:in `abort': wrong # of arguments(1 for 0) (ArgumentError) from a.rb:1 you see, the feature you may be trying to protect from old version may get short circuited because an older ruby will not even make it through compilation... all this takes is something like require 'a_newish_lib' to cause this. regards. -a -- share your knowledge. it's a way to achieve immortality. - h.h. the 14th dali lama