instance method _insert_callbacks

Ruby on Rails 4.0.13

Since v3.0.20

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

_insert_callbacks(callbacks, block = nil)

Take callback names and an optional callback proc, normalize them, then call the block with each callback. This allows us to abstract the normalization across several methods that use it.

Parameters

  • callbacks - An array of callbacks, with an optional options hash as the last parameter.

  • block - A proc that should be added to the callbacks.

Block Parameters

  • name - The callback to be added

  • options - A hash of options to be used when adding the callback

Parameters

callbacks req
block opt = nil
Source
# File actionpack/lib/abstract_controller/callbacks.rb, line 71
      def _insert_callbacks(callbacks, block = nil)
        options = callbacks.last.is_a?(Hash) ? callbacks.pop : {}
        _normalize_callback_options(options)
        callbacks.push(block) if block
        callbacks.each do |callback|
          yield callback, options
        end
      end

Defined in actionpack/lib/abstract_controller/callbacks.rb line 71 · View on GitHub · Improve this page · Find usages on GitHub

Defined in AbstractController::Callbacks::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close