made initial_session_setup test for initial_session? inside itself

This commit is contained in:
John Mair 2011-11-15 03:16:38 +13:00
parent 4212baca6d
commit 7cc5176d93
1 changed files with 4 additions and 3 deletions

View File

@ -77,6 +77,9 @@ class Pry
# Including: loading .pryrc, loading plugins, loading requires, and # Including: loading .pryrc, loading plugins, loading requires, and
# loading history. # loading history.
def self.initial_session_setup def self.initial_session_setup
return if !initial_session?
# note these have to be loaded here rather than in pry_instance as # note these have to be loaded here rather than in pry_instance as
# we only want them loaded once per entire Pry lifetime, not # we only want them loaded once per entire Pry lifetime, not
# multiple times per each new session (i.e in debugging) # multiple times per each new session (i.e in debugging)
@ -98,9 +101,7 @@ class Pry
# Pry.start(Object.new, :input => MyInput.new) # Pry.start(Object.new, :input => MyInput.new)
def self.start(target=TOPLEVEL_BINDING, options={}) def self.start(target=TOPLEVEL_BINDING, options={})
target = Pry.binding_for(target) target = Pry.binding_for(target)
if initial_session? initial_session_setup
initial_session_setup
end
Pry.config.hooks.exec_hook(:when_started, target) Pry.config.hooks.exec_hook(:when_started, target)
new(options).repl(target) new(options).repl(target)