class Pry::PluginManager
def gem_located?(gem_name)
def gem_located?(gem_name) @plugins.any? { |plugin| plugin.gem_name == gem_name } end
def initialize
def initialize @plugins = [] end
def load_plugins
def load_plugins @plugins.each do |plugin| plugin.activate! if plugin.enabled? end end
def locate_plugins
def locate_plugins Gem.refresh (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem| next if gem.name !~ PRY_PLUGIN_PREFIX plugin_name = gem.name.split('-', 2).last @plugins << Plugin.new(plugin_name, gem.name, gem, true) if !gem_located?(gem.name) end @plugins end
def plugins
-
(Hash)
- A hash with all plugin names (minus the 'pry-') as
def plugins h = Hash.new { |_, key| NoPlugin.new(key) } @plugins.each do |plugin| h[plugin.name] = plugin end h end