[Rubygems-developers] Another plug for Simon's patch

Jamis Buck jgb3 at email.byu.edu
Tue Mar 30 23:08:55 EST 2004

Here's another reason why I believe that Simon's patch ought to be 
"standard procedure":

I've got a library that has a dependency on Log4r. This library is 
currently available as a gem and a non-gem. In my library, I cannot 
guarantee that the users are going to have Log4r installed as a gem, so 
I currently have to do the following hack:

     require 'rubygems'
     require_gem 'log4r'
   rescue Exception
     require 'log4r'

Not only is that rather ugly to read, it becomes exceptionally difficult 
to maintain as soon as I need more than one library file to require 
Log4r. (Yes, I can also create my own wrapper file for the above, and 
then just require that, but that's not exactly an elegant solution, either.)

With Simon's patch, I simply "require 'log4r'" and leave the rest up to 
the internals.

Jamis Buck
jgb3 at email.byu.edu

ruby -h | ruby -e 
'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << 
r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'

More information about the Rubygems-developers mailing list