module Middleman::CoreExtensions::Extensions::InstanceMethods
def activate(ext, options={}, &block)
-
(void)
-
Parameters:
-
ext
(Symbol, Module
) -- Which extension to activate
def activate(ext, options={}, &block) ext_module = if ext.is_a?(Module) ext else ::Middleman::Extensions.load(ext) end if ext_module.nil? logger.error "== Unknown Extension: #{ext}" else logger.debug "== Activating: #{ext}" if ext_module.instance_of? Module extensions[ext] = self.class.register(ext_module, options, &block) elsif ext_module.instance_of?(Class) && ext_module.ancestors.include?(::Middleman::Extension) if ext_module.supports_multiple_instances? extensions[ext] ||= {} key = "instance_#{extensions[ext].keys.length}" extensions[ext][key] = ext_module.new(self.class, options, &block) else if extensions[ext] logger.error "== #{ext} already activated." else extensions[ext] = ext_module.new(self.class, options, &block) end end end end end