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

  • options (Hash) (defaults to: {})

    options to pass to creating Pluginator instance

  • type (Hash)

    a customizable set of options

  • extends (Hash)

    a customizable set of options



41
42
43
44
# File 'lib/pluginator/extendable_autodetect.rb', line 41

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 (Array<Symbol>|Symbol)

    list of extension to extend into pluginator instance



49
50
51
52
53
# File 'lib/pluginator/extendable_autodetect.rb', line 49

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