Needed to add a proc in my class/object on runtime to execute some code using inner variables and other private class methods (can't provide more details).
Was wondering how to achieve this so arrived at my own solution (provided as the current answer). Is there a better way of doing the same?