Skip to content
This repository
Browse code

Add missing quotes on AS::Notifications examples

  • Loading branch information...
commit a1c77e7d947cf61ae01869075282c66816add419 1 parent 55df1df
Carlos Antonio da Silva authored March 15, 2012
24  railties/guides/source/active_support_instrumentation.textile
Source Rendered
@@ -156,7 +156,7 @@ h4. redirect_to.action_controller
156 156
 
157 157
 <ruby>
158 158
 {
159  
-  :status => 302, 
  159
+  :status => 302,
160 160
   :location => "http://localhost:3000/posts/new"
161 161
 }
162 162
 </ruby>
@@ -305,7 +305,7 @@ This event is only used when +#fetch+ is called with a block.
305 305
 INFO. Options passed to fetch will be merged with the payload when writing to the store
306 306
 
307 307
 <ruby>
308  
-{ 
  308
+{
309 309
   :key => 'name-of-complicated-computation'
310 310
 }
311 311
 </ruby>
@@ -321,7 +321,7 @@ This event is only used when +#fetch+ is called with a block.
321 321
 INFO. Options passed to fetch will be merged with the payload.
322 322
 
323 323
 <ruby>
324  
-{ 
  324
+{
325 325
   :key => 'name-of-complicated-computation'
326 326
 }
327 327
 </ruby>
@@ -334,7 +334,7 @@ h4. cache_write.active_support
334 334
 INFO. Cache stores my add their own keys
335 335
 
336 336
 <ruby>
337  
-{ 
  337
+{
338 338
   :key => 'name-of-complicated-computation'
339 339
 }
340 340
 </ruby>
@@ -345,7 +345,7 @@ h4. cache_delete.active_support
345 345
 |+:key+  |Key used in the store|
346 346
 
347 347
 <ruby>
348  
-{ 
  348
+{
349 349
   :key => 'name-of-complicated-computation'
350 350
 }
351 351
 </ruby>
@@ -356,7 +356,7 @@ h4. cache_exist?.active_support
356 356
 |+:key+  |Key used in the store|
357 357
 
358 358
 <ruby>
359  
-{ 
  359
+{
360 360
   :key => 'name-of-complicated-computation'
361 361
 }
362 362
 </ruby>
@@ -371,7 +371,7 @@ h4. deprecation.rails
371 371
 
372 372
 h3. Subscribing to an event
373 373
 
374  
-Subscribing to an event is easy. Use +ActiveSupport::Notifications.subscribe+ with a block to 
  374
+Subscribing to an event is easy. Use +ActiveSupport::Notifications.subscribe+ with a block to
375 375
 listen to any notification.
376 376
 
377 377
 The block receives the following arguments:
@@ -383,7 +383,7 @@ The block receives the following arguments:
383 383
 # The payload (described in previous sections)
384 384
 
385 385
 <ruby>
386  
-ActiveSupport::Notifications.subscribe "process_action.action_controller do |name, started, finished, unique_id, data|
  386
+ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, started, finished, unique_id, data|
387 387
   # your own custom stuff
388 388
   Rails.logger.info "#{name} Received!"
389 389
 end
@@ -393,7 +393,7 @@ Defining all those block arguments each time can be tedious. You can easily crea
393 393
 from block args like this:
394 394
 
395 395
 <ruby>
396  
-ActiveSupport::Notifications.subscribe "process_action.action_controller do |*args|
  396
+ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
397 397
   event = ActiveSupport::Notification::Event.new args
398 398
 
399 399
   event.name      # => "process_action.action_controller"
@@ -407,7 +407,7 @@ end
407 407
 Most times you only care about the data itself. Here is a shortuct to just get the data.
408 408
 
409 409
 <ruby>
410  
-ActiveSupport::Notifications.subscribe "process_action.action_controller do |*args|
  410
+ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
411 411
   data = args.extract_options!
412 412
   data # { :extra => :information }
413 413
 </ruby>
@@ -431,7 +431,7 @@ as well as the unique ID. All data passed into the +insturment+ call will make i
431 431
 Here's an example:
432 432
 
433 433
 <ruby>
434  
-ActiveSupport::Notifications.instrument "my.custom.event", :this => :data do 
  434
+ActiveSupport::Notifications.instrument "my.custom.event", :this => :data do
435 435
   # do your custom stuff here
436 436
 end
437 437
 </ruby>
@@ -444,5 +444,5 @@ ActiveSupport::Notifications.subscribe "my.custom.event" do |name, started, fini
444 444
 end
445 445
 </ruby>
446 446
 
447  
-You should follow Rails conventions when defining your own events. The format is: +event.library+. 
  447
+You should follow Rails conventions when defining your own events. The format is: +event.library+.
448 448
 If you application is sending Tweets, you should create an event named +tweet.twitter+.

0 notes on commit a1c77e7

Please sign in to comment.
Something went wrong with that request. Please try again.