module ActiveSupport::Notifications
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/active_support/notifications.rbs module ActiveSupport::Notifications type ActiveSupport__Notifications_instrument_return_value = ActionView::OutputBuffer | Symbol | nil | Types::Sample | ActionView::AbstractRenderer::RenderedTemplate | String def instrument: (String name, ?Hash payload) -> ActiveSupport__Notifications_instrument_return_value def instrumenter: () -> ActiveSupport::Notifications::Instrumenter def registry: () -> Hash def subscribe: (?String pattern, ?ActionView::LogSubscriber? callback, ) -> (ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::Timed) def unsubscribe: (ActiveSupport::Notifications::Fanout::Subscribers::Timed subscriber_or_name) -> nil end
def instrument(name, payload = {})
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActiveSupport__Notifications_instrument_return_value = ActionView::OutputBuffer | Symbol | nil | Types::Sample | ActionView::AbstractRenderer::RenderedTemplate | String type ActiveSupport__Notifications_instrument_payload = virtual_path | String | identifier | String | sql | String | binds | | type_casted_binds | Proc | name | String | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | cached | TrueClass | name | Symbol | strategy | Symbol | traits | | overrides | gem_name | String | gem_version | String | receiver | String | method_name | String | parameters | | return_value | String | factory | FactoryBot::Factory | name | Symbol | strategy | Symbol | traits | | overrides | gem_name | String | gem_version | String | receiver | String | method_name | String | parameters | Array | String | String | String | Array | String | String | String | Array | String | String | String | return_value | String | factory | FactoryBot::Factory | controller | String | action | String | request | ActionDispatch::Request | params | controller | String | action | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String | response | ActionDispatch::Response | status | Integer | view_runtime | Float | db_runtime | Float | controller | String | action | String | request | ActionDispatch::Request | params | controller | String | action | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String | name | Symbol | strategy | Symbol | traits | | overrides | gem_name | String | gem_version | String | receiver | String | method_name | String | parameters | | return_value | NilClass | factory | FactoryBot::Factory | identifier | String | layout | NilClass | cache_hit | NilClass | controller | String | action | String | request | ActionDispatch::Request | params | controller | String | action | String | gem | String | version | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String | identifier | String | layout | NilClass | controller | String | action | String | request | ActionDispatch::Request | params | path | String | controller | String | action | String | headers | ActionDispatch::Http::Headers | format | String | method | String | path | String | response | ActionDispatch::Response | status | Integer | view_runtime | Float | db_runtime | Integer def instrument: (String name, ?ActiveSupport__Notifications_instrument_payload payload) -> ActiveSupport__Notifications_instrument_return_value
This signature was generated using 27 samples from 2 applications.
def instrument(name, payload = {}) if notifier.listening?(name) instrumenter.instrument(name, payload) { yield payload if block_given? } else yield payload if block_given? end end
def instrumenter
Experimental RBS support (using type sampling data from the type_fusion
project).
def instrumenter: () -> ActiveSupport::Notifications::Instrumenter
This signature was generated using 22 samples from 2 applications.
def instrumenter registry[notifier] ||= Instrumenter.new(notifier) end
def monotonic_subscribe(pattern = nil, callback = nil, &block)
duration is important. For example, computing elapsed time between
Daylights Savings). Use +monotonic_subscribe+ when accuracy of time
time. Monotonic time will not jump forward or backward (due to NTP or
+finish+ block arguments are in monotonic time instead of wall-clock
Performs the same functionality as #subscribe, but the +start+ and
def monotonic_subscribe(pattern = nil, callback = nil, &block) notifier.subscribe(pattern, callback, monotonic: true, &block) end
def publish(name, *args)
def publish(name, *args) notifier.publish(name, *args) end
def publish_event(event) # :nodoc:
def publish_event(event) # :nodoc: notifier.publish_event(event) end
def registry
Experimental RBS support (using type sampling data from the type_fusion
project).
def registry: () -> (#<ActiveSupport::Notifications::Fanout:0x000000010cd72dc0> | ActiveSupport::Notifications::Instrumenter | #<ActiveSupport::Notifications::Fanout:0x000000010ae3f7c8> | ActiveSupport::Notifications::Instrumenter | #<ActiveSupport::Notifications::Fanout:0x000000010581fd98> | ActiveSupport::Notifications::Instrumenter)
This signature was generated using 19 samples from 3 applications.
def registry ActiveSupport::IsolatedExecutionState[:active_support_notifications_registry] ||= {} end
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::Evented | ActiveSupport::Notifications::Fanout::Subscribers::Timed)
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
def subscribed(callback, pattern = nil, monotonic: false, &block)
def subscribed(callback, pattern = nil, monotonic: false, &block) subscriber = notifier.subscribe(pattern, callback, monotonic: monotonic) yield ensure unsubscribe(subscriber) end
def unsubscribe(subscriber_or_name)
Experimental RBS support (using type sampling data from the type_fusion
project).
def unsubscribe: (ActiveSupport::Notifications::Fanout::Subscribers::Timed subscriber_or_name) -> nil
This signature was generated using 13 samples from 1 application.
def unsubscribe(subscriber_or_name) notifier.unsubscribe(subscriber_or_name) end