Adding method as GString expression to per-instance metaclass
Hi all,
I tried to add dynamic method to per-instance metaclass, the method itself is in the form of GString expression as follows:
def emc = new ExpandoMetaClass(Expando);
def methodName = 'getTest';
emc."$methodName" = {-> println 'Hello World';};
emc.initialize();
def expando = new Expando();
expando.metaClass = emc;
Than I call the method :
expando.test;
No error was thrown but the closure within 'getTest' is never called
Any ideas ?
Regards,
Setya