diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2018-07-26 14:54:47 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2018-07-26 14:54:47 -0700 |
commit | 3699ec9d1bd48332d1aef7def38f913c4773257c (patch) | |
tree | e060f50b661b3e5ffa96bc223d3a36da0ca5632d /activesupport | |
parent | 280670465ad54f0600dcc8f3a22ee130d623593c (diff) | |
download | rails-3699ec9d1bd48332d1aef7def38f913c4773257c.tar.gz rails-3699ec9d1bd48332d1aef7def38f913c4773257c.tar.bz2 rails-3699ec9d1bd48332d1aef7def38f913c4773257c.zip |
Add changelog entry
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 10a25a120d..e789d7fa20 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,37 @@ +* Add "event object" support to the notification system. + Before this change, end users were forced to create hand made arsenal + event objects on their own, like this: + + ActiveSupport::Notifications.subscribe('wait') do |*args| + @event = ActiveSupport::Notifications::Event.new(*args) + end + + ActiveSupport::Notifications.instrument('wait') do + sleep 1 + end + + @event.duration # => 1000.138 + + After this change, if the block passed to `subscribe` only takes one + parameter, the framework will yield an event object to the block. Now + end users are no longer required to make their own: + + ActiveSupport::Notifications.subscribe('wait') do |event| + @event = event + end + + ActiveSupport::Notifications.instrument('wait') do + sleep 1 + end + + p @event.allocations # => 7 + p @event.cpu_time # => 0.256 + p @event.idle_time # => 1003.2399 + + Now you can enjoy event objects without making them yourself. Neat! + + *Aaron "t.lo" Patterson* + * Add cpu_time, idle_time, and allocations to Event *Eileen M. Uchitelle*, *Aaron Patterson* |