diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-09-12 13:46:33 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-09-12 13:47:49 -0500 |
commit | f4e180578c673194f58d4ff5a4a656cc51b2249e (patch) | |
tree | c1004a8c06730d9cea9f5dd0e5837f95f7713258 /activesupport/lib/active_support/notifications.rb | |
parent | 961355a9f34a9cdb3001d8a4b69741408145ebb8 (diff) | |
download | rails-f4e180578c673194f58d4ff5a4a656cc51b2249e.tar.gz rails-f4e180578c673194f58d4ff5a4a656cc51b2249e.tar.bz2 rails-f4e180578c673194f58d4ff5a4a656cc51b2249e.zip |
update some AS code examples to 1.9 hash syntax [ci skip]
Diffstat (limited to 'activesupport/lib/active_support/notifications.rb')
-rw-r--r-- | activesupport/lib/active_support/notifications.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index b4657a8ba9..83fb71a97d 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -10,13 +10,13 @@ module ActiveSupport # # To instrument an event you just need to do: # - # ActiveSupport::Notifications.instrument("render", :extra => :information) do - # render :text => "Foo" + # ActiveSupport::Notifications.instrument('render', extra: :information) do + # render text: 'Foo' # end # # That executes the block first and notifies all subscribers once done. # - # In the example above "render" is the name of the event, and the rest is called + # In the example above +render+ is the name of the event, and the rest is called # the _payload_. The payload is a mechanism that allows instrumenters to pass # extra information to subscribers. Payloads consist of a hash whose contents # are arbitrary and generally depend on the event. @@ -28,21 +28,21 @@ module ActiveSupport # # events = [] # - # ActiveSupport::Notifications.subscribe("render") do |*args| + # ActiveSupport::Notifications.subscribe('render') do |*args| # events << ActiveSupport::Notifications::Event.new(*args) # end # # That code returns right away, you are just subscribing to "render" events. # The block is saved and will be called whenever someone instruments "render": # - # ActiveSupport::Notifications.instrument("render", :extra => :information) do - # render :text => "Foo" + # ActiveSupport::Notifications.instrument('render', extra: :information) do + # render text: 'Foo' # end # # event = events.first # event.name # => "render" # event.duration # => 10 (in milliseconds) - # event.payload # => { :extra => :information } + # event.payload # => { extra: :information } # # The block in the <tt>subscribe</tt> call gets the name of the event, start # timestamp, end timestamp, a string with a unique identifier for that event @@ -63,7 +63,7 @@ module ActiveSupport # module ActionController # class PageRequest # def call(name, started, finished, unique_id, payload) - # Rails.logger.debug ["notification:", name, started, finished, unique_id, payload].join(" ") + # Rails.logger.debug ['notification:', name, started, finished, unique_id, payload].join(' ') # end # end # end |