When invoking the original method, we use object.send(original_method_name, *args) rather than object.method(…).call(*args). The latter fails when the original method calls super. This is a Ruby bug: www.ruby-forum.com/topic/124276
Note that we extract the block passed to the original method call, if any, from the context and pass it to method invocation.
# File lib/aquarium/aspects/advice.rb, line 159 def initialize options = {} super options end
# File lib/aquarium/aspects/advice.rb, line 162 def advice_wrapper jp jp.context.advised_object.send @alias_method_name, *jp.context.parameters, &jp.context.block_for_method end