2012-08-11 20:22:29 -04:00
|
|
|
class Pry
|
2012-08-11 21:26:59 -04:00
|
|
|
Pry::Commands.create_command "exit-all" do
|
|
|
|
group 'Navigating Pry'
|
|
|
|
description "End the current Pry session (popping all bindings) and " \
|
|
|
|
"returning to caller. Accepts optional return value. Aliases: !!@"
|
2012-08-11 20:22:29 -04:00
|
|
|
|
2012-08-11 21:26:59 -04:00
|
|
|
def process
|
|
|
|
# calculate user-given value
|
|
|
|
exit_value = target.eval(arg_string)
|
2012-08-11 20:22:29 -04:00
|
|
|
|
2012-08-11 21:26:59 -04:00
|
|
|
# clear the binding stack
|
|
|
|
_pry_.binding_stack.clear
|
|
|
|
|
|
|
|
# break out of the repl loop
|
|
|
|
throw(:breakout, exit_value)
|
|
|
|
end
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Pry::Commands.alias_command "!!@", "exit-all"
|
|
|
|
end
|