Class: Guard::Jobs::PryWrapper
- Defined in:
- lib/guard/jobs/pry_wrapper.rb
Constant Summary collapse
- GUARD_RC =
The default Ruby script to configure Guard Pry if the option ‘:guard_rc` is not defined.
if ENV["XDG_CONFIG_HOME"] && File.exist?(ENV["XDG_CONFIG_HOME"] + "/guard/guardrc") ENV["XDG_CONFIG_HOME"] + "/guard/guardrc" else "~/.guardrc" end
- HISTORY_FILE =
The default Guard Pry history file if the option ‘:history_file` is not defined.
if ENV["XDG_DATA_HOME"] && File.exist?(ENV["XDG_DATA_HOME"] + "/guard/history") ENV["XDG_DATA_HOME"] + "/guard/history" else "~/.guard_history" end
- SHORTCUTS =
List of shortcuts for each interactor command
{ help: "h", all: "a", reload: "r", change: "c", show: "s", scope: "o", notification: "n", pause: "p", exit: "e", quit: "q" }
Instance Method Summary collapse
- #background ⇒ Object
- #foreground ⇒ Object
- #handle_interrupt ⇒ Object
-
#initialize(options) ⇒ PryWrapper
constructor
A new instance of PryWrapper.
Constructor Details
#initialize(options) ⇒ PryWrapper
Returns a new instance of PryWrapper.
73 74 75 76 77 78 79 |
# File 'lib/guard/jobs/pry_wrapper.rb', line 73 def initialize() @mutex = Mutex.new @thread = nil @terminal_settings = TerminalSettings.new _setup() end |
Instance Method Details
#background ⇒ Object
94 95 96 |
# File 'lib/guard/jobs/pry_wrapper.rb', line 94 def background _kill_pry end |
#foreground ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/guard/jobs/pry_wrapper.rb', line 81 def foreground UI.debug "Start interactor" @terminal_settings.save _switch_to_pry # TODO: rename :stopped to continue _killed? ? :stopped : :exit ensure UI.reset_line UI.debug "Interactor was stopped or killed" @terminal_settings.restore end |
#handle_interrupt ⇒ Object
98 99 100 101 102 |
# File 'lib/guard/jobs/pry_wrapper.rb', line 98 def handle_interrupt thread = @thread fail Interrupt unless thread thread.raise Interrupt end |