Class: Standard::Plugin::InitializesPlugins

Inherits:
Object
  • Object
show all
Defined in:
lib/standard/plugin/initializes_plugins.rb

Instance Method Summary collapse

Constructor Details

#initializeInitializesPlugins

Returns a new instance of InitializesPlugins.



4
5
6
7
# File 'lib/standard/plugin/initializes_plugins.rb', line 4

def initialize
  @standardizes_configured_plugins = StandardizesConfiguredPlugins.new
  @determines_class_constants = DeterminesClassConstant.new
end

Instance Method Details

#call(plugins) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/standard/plugin/initializes_plugins.rb', line 9

def call(plugins)
  plugin_configs = @standardizes_configured_plugins.call(plugins)
  plugin_configs.map { |name_or_class, user_config|
    if user_config["enabled"]
      if name_or_class.is_a?(String) || name_or_class.is_a?(Symbol)
        @determines_class_constants.call(name_or_class, user_config).new(user_config)
      else
        name_or_class.new(user_config)
      end
    end
  }
end