Class: Pluginator::ExtendableAutodetect

Inherits:
Autodetect show all
Defined in:
lib/pluginator/extendable_autodetect.rb

Overview

Add extendability to Atudetect / Group

See Also:

Instance Attribute Summary

Attributes inherited from Group

#group

Instance Method Summary collapse

Methods inherited from Autodetect

#type

Methods inherited from Group

#[], #register_plugin, #types

Constructor Details

#initialize(group, options = {}) ⇒ ExtendableAutodetect

Automatically load plugins for given group (and type) Extend instance with extensions if given.

Parameters:

  • group (String)

    name of the plugins group

  • type (Hash)

    a customizable set of options

  • extends (Hash)

    a customizable set of options



21
22
23
24
# File 'lib/pluginator/extendable_autodetect.rb', line 21

def initialize(group, options = {})
  super(group, options)
  extend_plugins(options[:extends]||[])
end

Instance Method Details

#extend_plugins(extends) ⇒ Object

Extend pluginator instance with given extensions

Parameters:

  • extends

    list of extension to extend into pluginator instance



29
30
31
32
33
# File 'lib/pluginator/extendable_autodetect.rb', line 29

def extend_plugins(extends)
  extensions_matching(extends).each do |plugin|
    extend plugin
  end
end