method
dispatch
v7.2.3 -
Show latest stable
- Class:
ActiveSupport::BroadcastLogger
dispatch(method, *args, **kwargs, &block)private
No documentation available.
# File activesupport/lib/active_support/broadcast_logger.rb, line 202
def dispatch(method, *args, **kwargs, &block)
if block_given?
# Maintain semantics that the first logger yields the block
# as normal, but subsequent loggers won't re-execute the block.
# Instead, the initial result is immediately returned.
called, result = false, nil
block = proc { |*args, **kwargs|
if called then result
else
called = true
result = yield(*args, **kwargs)
end
}
end
@broadcasts.map { |logger|
logger.send(method, *args, **kwargs, &block)
}.first
end