Class: Droonga::PluginLoader
- Inherits:
-
Object
- Object
- Droonga::PluginLoader
- Includes:
- Loggable
- Defined in:
- lib/droonga/plugin_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ PluginLoader
constructor
A new instance of PluginLoader.
- #load(name) ⇒ Object
- #load_all ⇒ Object
Constructor Details
#initialize ⇒ PluginLoader
Returns a new instance of PluginLoader.
33 34 |
# File 'lib/droonga/plugin_loader.rb', line 33 def initialize end |
Class Method Details
.load_all ⇒ Object
27 28 29 30 |
# File 'lib/droonga/plugin_loader.rb', line 27 def load_all loader = new loader.load_all end |
Instance Method Details
#load(name) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/droonga/plugin_loader.rb', line 36 def load(name) logger.debug("loading...: <#{name}>") path = "droonga/plugins/#{name}" begin require path rescue StandardError, SyntaxError => error logger.exception("failed to load: <#{path}>", error) raise end end |
#load_all ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/droonga/plugin_loader.rb', line 47 def load_all $LOAD_PATH.each do |load_path| search_pattern = "#{load_path}/droonga/plugins/*.rb" logger.debug("searching...: <#{search_pattern}>") Pathname.glob(search_pattern) do |plugin_path| name = Pathname(plugin_path).basename(".rb").to_s load(name) end end end |