Class: Pluginator::Autodetect

Inherits:
Group
  • Object
show all
Includes:
NameConverter
Defined in:
lib/pluginator/autodetect.rb

Overview

Add autodetection capabilities to Group

See Also:

Direct Known Subclasses

ExtendableAutodetect

Instance Attribute Summary

Attributes inherited from Group

#group

Instance Method Summary collapse

Methods inherited from Group

#[], #register_plugin, #types

Constructor Details

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

Automatically load plugins for given group (and type)

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



34
35
36
37
# File 'lib/pluginator/autodetect.rb', line 34

def initialize(group, options = {})
  super(group)
  setup_autodetect(options[:type])
end

Instance Method Details

#typeObject

Return the forced type



40
41
42
# File 'lib/pluginator/autodetect.rb', line 40

def type
  @plugins[@force_type] unless @force_type.nil?
end