2010-12-27 05:56:55 -05:00
|
|
|
class Pry
|
2011-01-19 03:40:43 -05:00
|
|
|
|
|
|
|
# The default hooks - display messages when beginning and ending Pry sessions.
|
2010-12-27 05:56:55 -05:00
|
|
|
DEFAULT_HOOKS = {
|
2011-04-18 17:31:39 -04:00
|
|
|
|
2011-03-05 09:17:54 -05: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 05:08:12 -04:00
|
|
|
|
|
|
|
# /unknown/ for rbx
|
2011-04-18 10:11:57 -04:00
|
|
|
if file !~ /(\(.*\))|<.*>/ && file !~ /__unknown__/ && file != "" && file != "-e"
|
2011-04-11 08:50:30 -04:00
|
|
|
Pry.run_command "whereami 5", :output => out, :show_output => true, :context => target, :commands => Pry::Commands
|
2011-03-05 09:17:54 -05:00
|
|
|
end
|
|
|
|
end,
|
2010-12-27 05:56:55 -05:00
|
|
|
}
|
|
|
|
end
|