Class: DepsGrapher::PluginLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/deps_grapher/plugin_loader.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plugin_dir) ⇒ PluginLoader

Returns a new instance of PluginLoader.



13
14
15
# File 'lib/deps_grapher/plugin_loader.rb', line 13

def initialize(plugin_dir)
  @plugin_dir = plugin_dir
end

Class Method Details

.load!(plugin_dir) ⇒ Object



6
7
8
# File 'lib/deps_grapher/plugin_loader.rb', line 6

def load!(plugin_dir)
  new(plugin_dir).load!
end

Instance Method Details

#load!Object



17
18
19
20
21
22
23
# File 'lib/deps_grapher/plugin_loader.rb', line 17

def load!
  return if plugin_dir.blank? || !Dir.exist?(plugin_dir)

  Dir.glob(File.join(plugin_dir, "**", "*.rb")).sort.each do |file|
    require file
  end
end