module ActiveSupport::Notifications

def subscribe(pattern = nil, callback = nil, &block)

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

def subscribe: (?String pattern, ?ActionView::LogSubscriber? callback, ) -> (ActiveSupport::Notifications::Fanout::Subscribers::Timed | ActiveSupport::Notifications::Fanout::Subscribers::Evented)

This signature was generated using 26 samples from 1 application.


#=> ArgumentError (pattern must be specified as a String, Regexp or empty)
ActiveSupport::Notifications.subscribe(:render) {|*args| ...}

Raises an error if invalid event name type is passed:

end
@event = event
ActiveSupport::Notifications.subscribe(/render/) do |event|

it will yield an event object to the block:
If the block passed to the method only takes one parameter,

end
payload # => Hash, the payload
id # => String, unique ID for the instrumenter that fired the event
finish # => Time, when the instrumented block ended execution
start # => Time, when the instrumented block started execution
name # => String, name of the event (such as 'render' from above)
ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload|

The +block+ will receive five parameters with information about the event:

end
@event = ActiveSupport::Notifications::Event.new(*args)
ActiveSupport::Notifications.subscribe(/render/) do |*args|

names, or by passing a Regexp to match all events that match a pattern.
You can subscribe to events by passing a String to match exact event

Subscribe to a given event name with the passed +block+.
def subscribe(pattern = nil, callback = nil, &block)
  notifier.subscribe(pattern, callback, monotonic: false, &block)
end