On Jun 13, 2006, at 6:02 PM, Eric Hodel wrote:

> On Jun 13, 2006, at 3:45 PM, Gregory Brown wrote:
>
>> That is not what I am referring to.  I don't want fastercsv to be
>> loaded at this point.  Obviously ruport will be loaded :)
>
> ruport loads fastercsv.
>
>> Since the require "fastercsv" is within the DataSet.load method there
>> is no reason why fastercsv should load at this point.
>
> Yes, there is.  ruport required it.

Neo:~/Desktop$ ruby -rubygems mini_ruport.rb
Ruport loaded.
Doing non-CSV stuff...
FasterCSV not loaded.
Now doing CSV stuff...
FasterCSV loaded.
Neo:~/Desktop$ cat mini_ruport.rb
#!/usr/local/bin/ruby -w

$check = lambda do
   if defined? FasterCSV
     "FasterCSV loaded."
   else
     "FasterCSV not loaded."
   end
end

def to_csv
   require "faster_csv"
   puts "Now doing CSV stuff..."
   puts $check.call
   # ...
end

def to_xml
   require "james_doesnt_have_this"
   # ...
end

puts "Ruport loaded."
puts "Doing non-CSV stuff..."
puts $check.call
to_csv

>> It does not when I am not using gems.
>
> If you're using ruport you're using gems.  ruport contains "require  
> 'rubygems'" somewhere inside.

Hmm, can't think of any good reason for it to do that.

James Edward Gray II