Well, I was able to resolve it.
The use of Proxy
here is not supposed. The CodeObject
s have a pretty peculiarity: they are “silent” singletons. Hence, as you have defined an object via CodeObject.new
, all the forthcoming calls to new
on the same object (according to Registry
) will be re-mapped to the existing one.
Therefore in my case I simply create the MethodObject
:
m = "#{astnode.jump(:string_content).source[1..-1]}";
obj = YARD::CodeObjects::MethodObject.new(namespace, "#{m}")
and then I do what I want on the newly created object:
obj.my_dsl_params = { :win => true, :mthd => "#{m}", … }
The object within method definition parse will merge
these properties with it’s own. The only need is either to register an object with register(obj)
or to return it from process
method for system registering.