aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r--activesupport/CHANGELOG.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 24ad72c45d..8808b38aac 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,41 @@
+* Add "event object" support to the notification system.
+ Before this change, end users were forced to create hand made artisanal
+ 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*
+
* RedisCacheStore: support key expiry in increment/decrement.
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.