Class: Pry::PluginManager
Defined Under Namespace
Constant Summary collapse
- PRY_PLUGIN_PREFIX =
/^pry-/
Instance Method Summary collapse
-
#initialize ⇒ PluginManager
constructor
A new instance of PluginManager.
-
#load_plugins ⇒ Object
Require all enabled plugins, disabled plugins are skipped.
-
#locate_plugins ⇒ Object
Find all installed Pry plugins and store them in an internal array.
-
#plugins ⇒ Hash
A hash with all plugin names (minus the ‘pry-’) as keys and Plugin objects as values.
Constructor Details
#initialize ⇒ PluginManager
Returns a new instance of PluginManager.
65 66 67 |
# File 'lib/pry/plugins.rb', line 65 def initialize @plugins = [] end |
Instance Method Details
#load_plugins ⇒ Object
Require all enabled plugins, disabled plugins are skipped.
91 92 93 94 95 |
# File 'lib/pry/plugins.rb', line 91 def load_plugins @plugins.each do |plugin| plugin.activate! if plugin.enabled? end end |
#locate_plugins ⇒ Object
Find all installed Pry plugins and store them in an internal array.
70 71 72 73 74 75 76 77 78 |
# File 'lib/pry/plugins.rb', line 70 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 |