diff options
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | lib/pry/pry_instance.rb | 13 |
2 files changed, 12 insertions, 3 deletions
@@ -44,7 +44,7 @@ task :default => [:test] desc "Run tests" task :test do check_dependencies unless ENV['SKIP_DEP_CHECK'] - sh "bacon -Itest -rubygems -a -q" + sh "bacon -Itest -rubygems" end desc "Run pry" diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index b2382214..3c675eab 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -645,14 +645,23 @@ class Pry # If input buffer is empty then use normal prompt if eval_string.empty? - Array(prompt).first.call(c) + generate_prompt(Array(prompt).first, c) # Otherwise use the wait prompt (indicating multi-line expression) else - Array(prompt).last.call(c) + generate_prompt(Array(prompt).last, c) end end + def generate_prompt(prompt_proc, conf) + if prompt_proc.arity == 1 + prompt_proc.call(conf) + else + prompt_proc.call(conf.object, conf.nesting_level, conf._pry_) + end + end + private :generate_prompt + # the array that the prompt stack is stored in def prompt_stack @prompt_stack ||= Array.new |