C
Clifford Heath
I'm doing some meta-programming where I want to add the same
instance and class methods to many other existing classes,
which I don't wish to re-superclass.
include <module> works nicely for including instance methods,
but to make class extensions as well, I need to use extend
with a module that uses class_def (from _why's metaid.rb)
Is there a way to avoid having to make two separate extension
modules and apply them separately, as in:
class Foo < ...whatever...
include InstanceExtensions
extend ClassExtensions
...
end
What I'd like is to define one extension module having both
class and instance methods, and insert them both into my class
with one statement. If I include and extend the same module,
like Facet's include_and_extend used to do, I get the instance
methods defined on the classes as well as the instances.
Any thoughts?
Clifford Heath.
instance and class methods to many other existing classes,
which I don't wish to re-superclass.
include <module> works nicely for including instance methods,
but to make class extensions as well, I need to use extend
with a module that uses class_def (from _why's metaid.rb)
Is there a way to avoid having to make two separate extension
modules and apply them separately, as in:
class Foo < ...whatever...
include InstanceExtensions
extend ClassExtensions
...
end
What I'd like is to define one extension module having both
class and instance methods, and insert them both into my class
with one statement. If I include and extend the same module,
like Facet's include_and_extend used to do, I get the instance
methods defined on the classes as well as the instances.
Any thoughts?
Clifford Heath.