Parent

Methods

Class Index [+]

Quicksearch

ActiveSupport::Callbacks::CallbackChain

An Array with a compile method

Attributes

name[R]
config[R]

Public Class Methods

new(name, config) click to toggle source
     # File lib/active_support/callbacks.rb, line 341
341:       def initialize(name, config)
342:         @name = name
343:         @config = {
344:           :terminator => "false",
345:           :rescuable => false,
346:           :scope => [ :kind ]
347:         }.merge(config)
348:       end

Public Instance Methods

compile(key=nil, object=nil) click to toggle source
     # File lib/active_support/callbacks.rb, line 350
350:       def compile(key=nil, object=nil)
351:         method = []
352:         method << "value = nil"
353:         method << "halted = false"
354: 
355:         each do |callback|
356:           method << callback.start(key, object)
357:         end
358: 
359:         if config[:rescuable]
360:           method << "rescued_error = nil"
361:           method << "begin"
362:         end
363: 
364:         method << "value = yield if block_given? && !halted"
365: 
366:         if config[:rescuable]
367:           method << "rescue Exception => e"
368:           method << "rescued_error = e"
369:           method << "end"
370:         end
371: 
372:         reverse_each do |callback|
373:           method << callback.end(key, object)
374:         end
375: 
376:         method << "raise rescued_error if rescued_error" if config[:rescuable]
377:         method << "halted ? false : (block_given? ? value : true)"
378:         method.compact.join("\n")
379:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.