Method: RHook::Invocation#proceed

Defined in:
lib/rhook.rb

#proceedObject Also known as: call

Proceed to execute the next one on hooks-chain. If no more hooks, execute the target method/procedure.

Returns:

  • The returned value from the target method/procedure. (may changed by hook)



290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/rhook.rb', line 290

def proceed
  hook = hooks[@hook_index]
  # -- If no more hook was found, calls target procedure and return
  hook or return self.returned = target_proc.call(*args, &block)
  # -- Set hook pointer to next, then call next hook
  @hook_index += 1
  begin
    self.returned = hook.call(self)
  ensure
    @hook_index -= 1
  end
end