Parent

Class/Module Index [+]

Quicksearch

ActiveSupport::Callbacks::CallbackChain

Public Class Methods

build(kind, *methods, &block) click to toggle source
# File lib/active_support/callbacks.rb, line 80
def self.build(kind, *methods, &block)
  methods, options = extract_options(*methods, &block)
  methods.map! { |method| Callback.new(kind, method, options) }
  new(methods)
end

Public Instance Methods

delete(callback) click to toggle source
# File lib/active_support/callbacks.rb, line 113
def delete(callback)
  super(callback.is_a?(Callback) ? callback : find(callback))
end
find(callback, &block) click to toggle source
# File lib/active_support/callbacks.rb, line 109
def find(callback, &block)
  select { |c| c == callback && (!block_given? || yield(c)) }.first
end
replace_or_append!(chain) click to toggle source

TODO: Decompose into more Array like behavior

# File lib/active_support/callbacks.rb, line 100
def replace_or_append!(chain)
  if index = index(chain)
    self[index] = chain
  else
    self << chain
  end
  self
end
run(object, options = {}, &terminator) click to toggle source
# File lib/active_support/callbacks.rb, line 86
def run(object, options = {}, &terminator)
  enumerator = options[:enumerator] || :each

  unless block_given?
    send(enumerator) { |callback| callback.call(object) }
  else
    send(enumerator) do |callback|
      result = callback.call(object)
      break result if terminator.call(result, object)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.