Skip to content

Commit

Permalink
whereami command now invoked on active pry instance instead of invoke…
Browse files Browse the repository at this point in the history
…d 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
  • Loading branch information
banister committed Sep 7, 2011
1 parent 95cd5f4 commit 877bc2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pry.rb
Expand Up @@ -6,13 +6,13 @@
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
}
Expand Down

0 comments on commit 877bc2a

Please sign in to comment.