# File lib/pry/plugins.rb, line 65 def initialize @plugins = [] end
Require all enabled plugins, disabled plugins are skipped.
# File lib/pry/plugins.rb, line 91 def load_plugins @plugins.each do |plugin| plugin.activate! if plugin.enabled? end end
Find all installed Pry plugins and store them in an internal array.
# 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
@return [Hash] A hash with all plugin names (minus the 'pry-') as
keys and Plugin objects as values.
# File lib/pry/plugins.rb, line 82 def plugins h = Hash.new { |_, key| NoPlugin.new(key) } @plugins.each do |plugin| h[plugin.name] = plugin end h end