Hi --

On Mon, 24 Feb 2003, Timothy Bauscher wrote:

> On Mon, Feb 24, 2003 at 11:13:15AM +0900, dblack / candle.superlink.net wrote:
> > > include is a method on class Module and I believe that Class already
> > > inherits from Module - I don't think you want Quinn to inherit from
> > > Module.  To get this to work you'd have to make 'quinn_loadModule' a
> > > class method, like:
> > >
> > > class Quinn
> > >   def Quinn.loadModule(modname)
> > >     load "modules/#{modname}.rb"
> > >     include #{modname}
> > >   end
> > > end
>
> Thanks Phil, that worked.
>
> > The include #{modname} thing will be read as "include" plus a comment,
> > though :-)
>
> And an eval() statement was necessary as well.

You should be able to dispense with that; try this:

  include Object.const_get(modname.to_s)

and you could then do:

  Quinn.load_module(Modname)      # constant

or

  Quinn.load_module("Modname")    # string


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav