class Pry::PluginManager

Constants

PRY_PLUGIN_PREFIX

Public Class Methods

new() click to toggle source
# File lib/pry/plugins.rb, line 65
def initialize
  @plugins = []
end

Public Instance Methods

load_plugins() click to toggle source

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
locate_plugins() click to toggle source

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
plugins() click to toggle source

@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