module ActiveSupport::Notifications::Fanout::Subscribers

def self.new(pattern, listener, monotonic)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.new: (String pattern, (Proc | ActionView::LogSubscriber) listener, false monotonic) -> (ActiveSupport::Notifications::Fanout::Subscribers::Timed | ActiveSupport::Notifications::Fanout::Subscribers::Evented)

This signature was generated using 15 samples from 1 application.

:nodoc:
def self.new(pattern, listener, monotonic)
  subscriber_class = monotonic ? MonotonicTimed : Timed
  if listener.respond_to?(:start) && listener.respond_to?(:finish)
    subscriber_class = Evented
  else
    # Doing this to detect a single argument block or callable
    # like `proc { |x| }` vs `proc { |*x| }`, `proc { |**x| }`,
    # or `proc { |x, **y| }`
    procish = listener.respond_to?(:parameters) ? listener : listener.method(:call)
    if procish.arity == 1 && procish.parameters.length == 1
      subscriber_class = EventObject
    end
  end
  subscriber_class.new(pattern, listener)
end