instance method
dispatch
Ruby on Rails 7.2.3
Since v7.1.6 PrivateSignature
dispatch(method, *args, **kwargs, &block)
No documentation comment.
Parameters
-
methodreq -
argsrest -
kwargskeyrest -
blockblock
Source
# 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
Defined in activesupport/lib/active_support/broadcast_logger.rb line 202
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::BroadcastLogger