Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use prompt proc arity instead of to_ary. God this is boring

  • Loading branch information...
commit 6214161672e32bbdb81eb2187720ca0664619cbd 1 parent 8fd91ec
@banister banister authored
Showing with 12 additions and 3 deletions.
  1. +1 −1  Rakefile
  2. +11 −2 lib/pry/pry_instance.rb
View
2  Rakefile
@@ -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"
View
13 lib/pry/pry_instance.rb
@@ -645,14 +645,23 @@ def c.to_ary() [object, nesting_level, _pry_] end
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.