lib/qonfig/plugins.rb in qonfig-0.18.1 vs lib/qonfig/plugins.rb in qonfig-0.19.0
- old
+ new
@@ -5,10 +5,11 @@
module Qonfig::Plugins
require_relative 'plugins/registry'
require_relative 'plugins/access_mixin'
require_relative 'plugins/abstract'
require_relative 'plugins/toml'
+ require_relative 'plugins/pretty_print'
# @since 0.4.0
@plugin_registry = Registry.new
# @since 0.4.0
@access_lock = Mutex.new
@@ -19,9 +20,23 @@
#
# @api public
# @since 0.4.0
def load(plugin_name)
thread_safe { plugin_registry[plugin_name].load! }
+ end
+
+ # @return [Array<String>]
+ #
+ # @api public
+ # @since 0.19.0
+ def loaded_plugins
+ thread_safe do
+ plugin_registry.select do |_plugin_name, plugin_module|
+ plugin_module.loaded?
+ end.map do |plugin_name, _plugin_module|
+ plugin_name
+ end
+ end
end
# @return [Array<String>]
#
# @api public