2012-10-31 04:24:06 -04:00
|
|
|
class Pry
|
2012-12-25 16:35:17 -05:00
|
|
|
class Command::DisablePry < Pry::ClassCommand
|
|
|
|
match 'disable-pry'
|
2012-10-31 04:42:55 -04:00
|
|
|
group 'Navigating Pry'
|
2012-10-31 04:24:06 -04:00
|
|
|
description 'Stops all future calls to pry and exits the current session.'
|
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
banner <<-'BANNER'
|
2012-10-31 04:24:06 -04:00
|
|
|
Usage: disable-pry
|
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
After this command is run any further calls to pry will immediately return `nil`
|
|
|
|
without interrupting the flow of your program. This is particularly useful when
|
|
|
|
you've debugged the problem you were having, and now wish the program to run to
|
|
|
|
the end.
|
2012-10-31 04:24:06 -04:00
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
As alternatives, consider using `exit!` to force the current Ruby process
|
2012-10-31 04:24:06 -04:00
|
|
|
to quit immediately; or using `edit-method -p` to remove the `binding.pry`
|
|
|
|
from the code.
|
|
|
|
BANNER
|
|
|
|
|
|
|
|
def process
|
2012-10-31 04:42:55 -04:00
|
|
|
ENV['DISABLE_PRY'] = 'true'
|
2012-10-31 04:24:06 -04:00
|
|
|
_pry_.run_command "exit"
|
|
|
|
end
|
|
|
|
end
|
2012-12-25 16:35:17 -05:00
|
|
|
|
|
|
|
Pry::Commands.add_command(Pry::Command::DisablePry)
|
2012-10-31 04:24:06 -04:00
|
|
|
end
|