2010-12-27 10:56:55 +00:00
|
|
|
class Pry
|
2011-01-19 08:40:43 +00:00
|
|
|
|
|
|
|
# The default hooks - display messages when beginning and ending Pry sessions.
|
2010-12-27 10:56:55 +00:00
|
|
|
DEFAULT_HOOKS = {
|
2011-04-18 21:31:39 +00:00
|
|
|
|
2011-03-05 14:17:54 +00:00
|
|
|
:before_session => proc do |out, target|
|
|
|
|
# ensure we're actually in a method
|
|
|
|
meth_name = target.eval('__method__')
|
|
|
|
file = target.eval('__FILE__')
|
2011-03-26 09:08:12 +00:00
|
|
|
|
|
|
|
# /unknown/ for rbx
|
2011-04-18 14:11:57 +00:00
|
|
|
if file !~ /(\(.*\))|<.*>/ && file !~ /__unknown__/ && file != "" && file != "-e"
|
2011-04-11 12:50:30 +00:00
|
|
|
Pry.run_command "whereami 5", :output => out, :show_output => true, :context => target, :commands => Pry::Commands
|
2011-03-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
end,
|
2010-12-27 10:56:55 +00:00
|
|
|
}
|
|
|
|
end
|