instance method
dispatch_block
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
dispatch_block(method, *args, **kwargs)
Complex dispatch for multiple loggers with a block given. The first logger to yield executes the block as normal. Subsequent loggers reuse the initial result
Parameters
-
methodreq -
argsrest -
kwargskeyrest
Source
# File activesupport/lib/active_support/broadcast_logger.rb, line 269
def dispatch_block(method, *args, **kwargs)
result = nil
called, memo = false, nil
@broadcasts.each_with_index do |logger, i|
value = logger.send(method, *args, **kwargs) do |*args, **kwargs|
if called
memo
else
called = true
memo = yield(*args, **kwargs)
end
end
result = value if i.zero?
end
result
end
Defined in activesupport/lib/active_support/broadcast_logger.rb line 269
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::BroadcastLogger