[Nitro] Simpler configuration method?
Jonathan Buch
john at oxyliquit.de
Sat Feb 3 16:11:15 EST 2007
Hi,
> Did you decide on this? Dod you do any work on this? Did you try
> making it an instatiable class?
George and I (and some others) discussed on that in #nitro for a
while. I managed to bring George away from the $global idea,
his current take on it is (I hope I get that right):
class Nitro::Conf < Hash
end
class Nitro::Compiler
Conf[:Compiler_mixin_get_parameters] = true
end
Which I found at least better than using 400 $globals just for the
Nitro internal configuration...
But, the namespace issue still stays. It's possible (since this is
a single hash) to override stuff accidentally. It also looks uglier
than:
class Nitro::Compiler
setting :mixin_get_parameters, :default => true, :doc => "/meth?a=foo like /meth/foo"
end
Where each Klass gets its own namespace for settings. Implementation
is slightly more complicated of course, also there are some issues with
'configuring not yet defined classes' (which is possible though, just
not as visually pleasing).
The current system also has the advantage of being able to view settings
nicely 'threaded' at run-time, even with documentation.
Jo
--
Feel the love
http://pinkjuice.com/pics/ruby.png
More information about the Nitro-general
mailing list