Replaced Pry.config.should_load_plugins with Pry.config.plugins.enabled. Also added Pry.config.plugins.strict_loading config option; also updated test helper to reflect changes

This commit is contained in:
John Mair 2011-06-02 21:41:41 +12:00
parent eb9238ab2b
commit 94a1f993e6
3 changed files with 13 additions and 3 deletions

View File

@ -81,6 +81,13 @@ class Pry
# saved to hist.file at session end.
# @return [OpenStruct]
attr_accessor :history
# Config option for plugins:
# sub-options include:
# `plugins.enabled` (Boolean) to toggle the loading of plugins on and off wholesale. (defaults to true)
# `plugins.strict_loading` (Boolean) which toggles whether referring to a non-existent plugin should raise an exception (defaults to `false`)
# @return [OpenStruct]
attr_accessor :plugins
end
end

View File

@ -96,7 +96,7 @@ class Pry
# we only want them loaded once per entire Pry lifetime, not
# multiple times per each new session (i.e in debugging)
load_rc if Pry.config.should_load_rc
load_plugins if Pry.config.should_load_plugins
load_plugins if Pry.config.plugins.enabled
load_history if Pry.config.history.load
@initial_session = false
@ -190,7 +190,10 @@ class Pry
config.pager = true
config.editor = default_editor_for_platform
config.should_load_rc = true
config.should_load_plugins = true
config.plugins ||= OpenStruct.new
config.plugins.enabled = true
config.plugins.strict_loading = true
config.history ||= OpenStruct.new
config.history.save = true

View File

@ -18,7 +18,7 @@ class << Pry
Pry.color = false
Pry.pager = false
Pry.config.should_load_rc = false
Pry.config.should_load_plugins = false
Pry.config.plugins.enabled = false
Pry.config.history.load = false
Pry.config.history.save = false
end