mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
documentation for plugins.rb
This commit is contained in:
parent
f993448fb6
commit
0fa64814b1
1 changed files with 6 additions and 0 deletions
|
@ -9,6 +9,7 @@ class Pry
|
|||
@name, @gem_name, @enabled = name, gem_name, enabled
|
||||
end
|
||||
|
||||
# Disable a plugin.
|
||||
def disable!
|
||||
self.enabled = false
|
||||
end
|
||||
|
@ -19,14 +20,18 @@ class Pry
|
|||
@plugins = []
|
||||
end
|
||||
|
||||
# Find all installed Pry plugins and store them in an internal array.
|
||||
def locate_plugins
|
||||
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, true)
|
||||
end
|
||||
@plugins
|
||||
end
|
||||
|
||||
# @return [Hash] A hash with all plugin names (minus the 'pry-') as
|
||||
# keys and Plugin objects as values.
|
||||
def plugins
|
||||
h = {}
|
||||
@plugins.each do |plugin|
|
||||
|
@ -35,6 +40,7 @@ class Pry
|
|||
h
|
||||
end
|
||||
|
||||
# Require all enabled plugins, disabled plugins are skipped.
|
||||
def load_plugins
|
||||
@plugins.each do |plugin|
|
||||
require plugin.gem_name if plugin.enabled?
|
||||
|
|
Loading…
Reference in a new issue