method

dispatch

Importance_0
v8.1.1 - Show latest stable - 0 notes - Class: BroadcastLogger
dispatch(method, *args, **kwargs, &block) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide 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
Register or log in to add new notes.