s2aspectメソッドにブロックが渡された場合は、ブロックがInterceptorとして実行されます。 ブロックへの引数は、MethodInvocationインスタンスです。MethodInvocationクラスのproceedメソッド呼び出しにより、 次のInterceptor、またはAspect対象メソッドが実行されます。
require 's2container'
class Action
s2comp
def index
s2logger.debug(self){"Action::index called."}
return 100
end
end
s2aspect(:pattern => Action) {|invocation|
invocation.proceed * 1.05
}
p s2app[Action].index # -> 105.0
![]() | NOTE |
|---|---|
|
この例は example/quickstart/quickstart7 にあります。 |
| © Copyright The Seasar Foundation and the others 2008-2009, all rights reserved. |