Class: Droonga::PluginLoader

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name) ⇒ PluginLoader

Returns a new instance of PluginLoader.



36
37
38
39
# File 'lib/droonga/plugin_loader.rb', line 36

def initialize(type, name)
  @type = type
  @name = name
end

Class Method Details

.load_allObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/droonga/plugin_loader.rb', line 21

def load_all
  $LOAD_PATH.each do |load_path|
    Dir.glob("#{load_path}/droonga/plugin/*") do |type_path|
      next unless File.directory?(type_path)
      type = File.basename(type_path)
      Dir.glob("#{type_path}/*.rb") do |path|
        name = File.basename(path, ".rb")
        plugin = new(type, name)
        plugin.load
      end
    end
  end
end

Instance Method Details

#loadObject



41
42
43
# File 'lib/droonga/plugin_loader.rb', line 41

def load
  require "droonga/plugin/#{@type}/#{@name}"
end