Class: RuboCop::Plugin::Loader Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/plugin/loader.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A class for loading and resolving plugins.

Constant Summary collapse

DEFAULT_PLUGIN_CONFIG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

rubocop:disable Layout/LineLength

{
  'enabled' => true,
  'require_path' => nil, # If not set, will be set to the plugin name
  'plugin_class_name' => nil # If not set, looks for gemspec `spec.metadata["default_lint_roller_plugin"]`
}.freeze

Class Method Summary collapse

Class Method Details

.load(plugins) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


20
21
22
23
24
25
26
27
28
29
# File 'lib/rubocop/plugin/loader.rb', line 20

def load(plugins)
  normalized_plugin_configs = normalize(plugins)
  normalized_plugin_configs.filter_map do |plugin_name, plugin_config|
    next unless plugin_config['enabled']

    plugin_class = constantize_plugin_from(plugin_name, plugin_config)

    plugin_class.new(plugin_config)
  end
end