[Nitro] Simpler configuration method?

transfire at gmail.com transfire at gmail.com
Sun Feb 4 13:20:30 EST 2007



On Feb 4, 12:28 pm, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> > I agree! What's being done presently is using a class/module as a
> > global variable store. This is good case of how Ruby can somtimes be
> > too flexible for it's own good. If you want globals then use a global
> > var. eg.
>
> >   $nitro.server.root_dir = my_dir
>
> this is *exactly* what I have said...
>
> But I still think this probaly could be done better (albiet with a
>
> > little more work) w/o globals via IOC.
>
> I think IOC will make things unnecessarily complicated...
>
> Anyway, I will not   touch the current configuration system for the time
> being (until someone suggests a clearly better alternative).

Then you have my +1 vote for using a global, but just make it a single
global (or at least very few globals) that everything gets tied too,
eg. $nitro.server or $nitro_server. The alternative is of course a
constant NiTro::Server, but while unlikely w/ contants there can be
name ambiguity:

  module Nitro
    Server = NitroServer.new
  end

  module MyModule
    module Nitro
      ...
      Nitro::Server.settings # oops wrong Nitro

T.



More information about the Nitro-general mailing list