class Guard::Internals::Debugging

Constants

TRACES

Public Class Methods

start() click to toggle source

Sets up debugging:

  • aborts on thread exceptions

  • Set the logging level to ‘:debug`

  • traces execution of Kernel.system and backtick calls

# File lib/guard/internals/debugging.rb, line 26
def start
  return if @started ||= false
  @started = true

  Thread.abort_on_exception = true

  UI.level = Logger::DEBUG

  TRACES.each { |mod, meth| _trace(mod, meth, &method(:_notify)) }
  @traced = true
end
stop() click to toggle source
# File lib/guard/internals/debugging.rb, line 38
def stop
  return unless @started ||= false
  UI.level = Logger::INFO
  _reset
end

Private Class Methods

_notify(*args) click to toggle source
# File lib/guard/internals/debugging.rb, line 46
def _notify(*args)
  UI.debug "Command execution: #{args.join(' ')}"
end
_reset() click to toggle source

reset singleton - called by tests

# File lib/guard/internals/debugging.rb, line 51
def _reset
  @started = false
  return unless @traced
  TRACES.each { |mod, meth| _untrace(mod, meth) }
  @traced = false
end
_trace(mod, meth, &block) click to toggle source
# File lib/guard/internals/debugging.rb, line 58
def _trace(mod, meth, &block)
  Tracing.trace(mod, meth, &block)
end
_untrace(mod, meth) click to toggle source
# File lib/guard/internals/debugging.rb, line 62
def _untrace(mod, meth)
  Tracing.untrace(mod, meth)
end