Deb Lewis
2006-Sep-19 07:49 UTC
[Masterview-devel] Redoing DirectiveDSL as a mixin rather than base class for DirectiveBase
... turns out to be pretty simple adjustment to what you''d already done. Preview stored in branches/djl-namespace-additions-sketch/directive_dsl.rb (includes namespace experiment, which you may or may not yet want in the trunk) Mods are: (1) DirectiveDSL is now a module, rather than a class. Replace: class << self include DirectiveDSLClassMethods # create class methods end with notification handler which is called when mixin include happens: # add class methods for DSL declarations to class which is mixing in DirectiveDSL def self.included(mixing_class) #:nodoc: mixing_class.extend(DirectiveDSLClassMethods) end (2) change DirectiveBase decl from: class DirectiveBase < DirectiveDSL to: class DirectiveBase include DirectiveDSL And that seems to do it. Unit tests all run, ditto quick check of a test app. ~ Deb