kelp icon indicating copy to clipboard operation
kelp copied to clipboard

new_anon does not work with reblessing

Open bbrtj opened this issue 7 months ago • 1 comments

A fix is required for new_anon method, which does not work correctly for subclasses, most notably controllers and reblessing. The new subclass of Kelp it creates will have all the module methods attached to it, while the other subclasses will have none. This seemingly obvious bug has gone unnoticed for quite some time, which probably means it's not seeing much use.

A better alternative would be to use what was done for #62 and mark new_anon instances with a special field. Then, Kelp::Module would check that field and change how the method is installed - from adding a method to a class, to adding a method to a hash used by autoload. This must also be adjusted for KelpX::Hooks, which now assumes methods are installed into the package.

Using each Kelp app as a singleton would still be the recommended way, but it would be nice to have new_anon method fixed.

bbrtj avatar Jul 05 '24 18:07 bbrtj