lib/active_support/notifications.rb in activesupport-6.1.7.10 vs lib/active_support/notifications.rb in activesupport-7.0.0.alpha1

- old
+ new

@@ -196,10 +196,14 @@ def publish(name, *args) notifier.publish(name, *args) end + def publish_event(event) # :nodoc: + notifier.publish_event(event) + end + def instrument(name, payload = {}) if notifier.listening?(name) instrumenter.instrument(name, payload) { yield payload if block_given? } else yield payload if block_given? @@ -229,9 +233,15 @@ # it will yield an event object to the block: # # ActiveSupport::Notifications.subscribe(/render/) do |event| # @event = event # end + # + # Raises an error if invalid event name type is passed: + # + # ActiveSupport::Notifications.subscribe(:render) {|*args| ...} + # #=> ArgumentError (pattern must be specified as a String, Regexp or empty) + # def subscribe(pattern = nil, callback = nil, &block) notifier.subscribe(pattern, callback, monotonic: false, &block) end def monotonic_subscribe(pattern = nil, callback = nil, &block)