Class: Pal::Plugin::PluginManager
- Inherits:
-
Object
- Object
- Pal::Plugin::PluginManager
- Includes:
- Log, Singleton
- Defined in:
- lib/pal/plugin.rb
Instance Method Summary collapse
Methods included from Log
#log_debug, #log_error, #log_info, #log_warn
Instance Method Details
#register(plugin_dir) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pal/plugin.rb', line 19 def register(plugin_dir) candidates = Dir.glob("#{plugin_dir}/**/*.rb").select { |e| File.file? e } log_info "Found a total of [#{candidates.size}] candidates" candidates.each do |file_path| full_clazz_name = get_clazz_name(file_path) next unless defined?(full_clazz_name) next unless full_clazz_name.start_with?("Pal::") log_info "[#{full_clazz_name}] has passed validation and will be loaded" load file_path validate_plugin(full_clazz_name) end end |