Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save benoittgt/a0d1b36a0fbcfa703f166fc631243b3b to your computer and use it in GitHub Desktop.

Select an option

Save benoittgt/a0d1b36a0fbcfa703f166fc631243b3b to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activesupport", "6.0.3"
end
require "active_support"
require "active_support/core_ext/object/blank"
events = []
ActiveSupport::Notifications.subscribe(/^(?!\!)\w+$/) do |*args|
events << ActiveSupport::Notifications::Event.new(*args)
end
ActiveSupport::Notifications.instrument('!render', extra: :information) do
p '!render'
end
ActiveSupport::Notifications.instrument('render', extra: :information) do
p 'render'
end
pp events
=begin
[#<ActiveSupport::Notifications::Event:0x00007fb8fd2d9430
@allocation_count_finish=0,
@allocation_count_start=0,
@children=[],
@cpu_time_finish=0,
@cpu_time_start=0,
@end=2020-08-02 18:18:00.068077 +0200,
@name="render",
@payload={:extra=>:information},
@time=2020-08-02 18:18:00.068057 +0200,
@transaction_id="2ee4830665b61ab5d72e">]
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment