问题
Ruby has method_missing
, Python has getattr
. Does Boo offer something I can use to intercept method calls?
回答1:
Yes, Boo has IQuackFu.
Basically, you implement IQuackFu
, which has three methods:
QuackGet
: gets called when you get a property valueQuackSet
gets called when you set a property valueQuackInvoke
: gets called when you invoke a method
Here's an example.
来源:https://stackoverflow.com/questions/1147641/how-can-i-intercept-a-method-call-in-boo