method

compile

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: CallbackChain
compile(type) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/callbacks.rb, line 653
        def compile(type)
          if type.nil?
            @all_callbacks || @mutex.synchronize do
              final_sequence = CallbackSequence.new
              @all_callbacks ||= @chain.reverse.inject(final_sequence) do |callback_sequence, callback|
                callback.apply(callback_sequence)
              end
            end
          else
            @single_callbacks[type] || @mutex.synchronize do
              final_sequence = CallbackSequence.new
              @single_callbacks[type] ||= @chain.reverse.inject(final_sequence) do |callback_sequence, callback|
                type == callback.kind ? callback.apply(callback_sequence) : callback_sequence
              end
            end
          end
        end
Register or log in to add new notes.