Francis Hwang
10/27/2004 2:37:00 AM
Unless I misunderstand autoload (I've never used it), it won't help
what I need. Basically, the Lafcadio ObjectStore uses method_missing
more than I've ever seen it used, to make the ObjectStore instance a
proxy for a bunch of different ways to query a database. The most
common usage is:
os = ObjectStore.get_object_store
client = os.get_client( 1 )
Now, the ObjectStore can only load a Client if it's already loaded the
Client class. I wanted to support a bunch of different ways of doing
this, and one of them is having a domain directory with each class
living in a file of the same name.
/domain_classes/Client.rb
/domain_classes/Invoice.rb
/domain_classes/Project.rb
etc.
(this is only one way to organize the domain classes in Lafcadio; these
days I find I don't use this much, myself.)
So one of the things Lafcadio tries to do is load the class by doing a
dynamic require:
require "domain_classes/#{ domain_class_name }"
So you don't have to explicitly require those files yourself.
On Oct 26, 2004, at 3:39 AM, gabriele renzi wrote:
> Francis Hwang ha scritto:
>
>> Nope. Basically this happens where you have, say
>> require "domain_classes/#{ domain_class_name }"
>> I've had this warning in Lafcadio from the start, because Lafcadio
>> does similar stuff in terms of inferring where files should be to
>> reduce user configuration.
>
> why not using autoload?
>