On 6/13/06, Eric Hodel <drbrain / segment7.net> wrote:

> > 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.

Eric, I think you are missing something here.
In ruby, if you put a require inside of a method, it is not required
until that method is called.

[sandal@harmonix ruport]$ irb --simple-prompt
>> def foo; require "rubygems"; end
=> nil
>> $LOADED_FEATURES.any? { |e| e =~ /rubygems/ }
=> false
>> foo
=> true
>> $LOADED_FEATURES.any? { |e| e =~ /rubygems/ }
=> true


require "ruport" does NOT call require "fastercsv"

Ruport::DataSet.load does

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

yes, it contains
begin; require "rubygems"; rescue LoadError; nil; end

because Ruport is installable via setup.rb, and when I develop it, I
do not have the ruport gem installed, and sometimes have the other
dependant libs installed manually or not at all.

Do you understand what I'm trying to do now