1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

whereami command now invoked on active pry instance instead of invoked through Pry.run_command

Advantages of this is the _file_ and _dir_ is set properly and also if current pry instance uses SIMPLE_PROMPT then a prompt using inspect wont be used on the temporary pry instance  as per #245
This commit is contained in:
John Mair 2011-09-08 03:13:27 +12:00
parent 95cd5f4724
commit 877bc2ade9

View file

@ -6,13 +6,13 @@ require 'pry/helpers/base_helpers'
class Pry
# The default hooks - display messages when beginning and ending Pry sessions.
DEFAULT_HOOKS = {
:before_session => proc do |out, target|
:before_session => proc do |out, target, _pry_|
# ensure we're actually in a method
file = target.eval('__FILE__')
# /unknown/ for rbx
if file !~ /(\(.*\))|<.*>/ && file !~ /__unknown__/ && file != "" && file != "-e"
Pry.run_command "whereami 5", :output => out, :show_output => true, :context => target, :commands => Pry::Commands
_pry_.process_line("whereami 5", "", target)
end
end
}