Method: ActiveSupport::Concern#prepended
- Defined in:
- activesupport/lib/active_support/concern.rb
#prepended(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 prepended block, it raises an exception.
175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'activesupport/lib/active_support/concern.rb', line 175 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 |