I want to implement methods like Ruby’s protected that will effect some
aspect of the subsequently defined methods. For example, I want write
sth like follows:
authorize_for :ROLE1, :ROLE2
def method2 ... end
In the def. on authorize_for method, I can use a global var to hold the
parameters passed and then use then in method_added callback.
However, once the class definition end, I no longer need those global
and I couldn’t find a way to mark them for gc (set to nil).
I need a way to be informed about the end of the class definition. I
considered set_trace_func but because there is no way to chain or
restore trace funcs after set, so that is not really an option.
I also checked for class_added callback, but according to the Ruby list,
it’s been refused because of lack of concrete usage.
Is there any other way to accomplish this?