Method: ActiveSupport::Concern#included

Defined in:
activesupport/lib/active_support/concern.rb

#included(base = nil, &block) ⇒ Object

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



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'activesupport/lib/active_support/concern.rb', line 158

def included(base = nil, &block)
  if base.nil?
    if instance_variable_defined?(:@_included_block)
      if @_included_block.source_location != block.source_location
        raise MultipleIncludedBlocks
      end
    else
      @_included_block = block
    end
  else
    super
  end
end