Module: Excom::Plugins::Pluggable

Included in:
Command
Defined in:
lib/excom/plugins/pluggable.rb

Instance Method Summary collapse

Instance Method Details

#use(name, **opts) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/excom/plugins/pluggable.rb', line 3

def use(name, **opts)
  extension = Plugins.fetch(name)

  method = extension.excom_options[:use_with] || :include
  send(method, extension)

  if extension.const_defined?('ClassMethods')
    extend extension::ClassMethods
  end

  if extension.respond_to?(:used)
    extension.used(self, **opts)
  end

  extension
end