instance method prepended

Ruby on Rails 7.0.10

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

prepended(base = nil, &block)

Evaluate given block in context of base class, so that you can write class macros here. When you define more than one prepended block, it raises an exception.

Parameters

base opt = nil
block block
Source
# File activesupport/lib/active_support/concern.rb, line 173
    def prepended(base = nil, &block)
      if base.nil?
        if instance_variable_defined?(:@_prepended_block)
          if @_prepended_block.source_location != block.source_location
            raise MultiplePrependBlocks
          end
        else
          @_prepended_block = block
        end
      else
        super
      end
    end

Defined in activesupport/lib/active_support/concern.rb line 173 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Concern

Type at least 2 characters to search.

↑↓ navigate · open · esc close