Class: Byebug::UntracevarCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/untracevar.rb

Overview

Stop tracing a global variable.

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#arguments, columnize, #context, #frame, help, #initialize, match, to_s

Methods included from Helpers::StringHelper

#camelize, #deindent, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



14
15
16
17
18
19
20
# File 'lib/byebug/commands/untracevar.rb', line 14

def self.description
  <<-DESCRIPTION
    untr[acevar] <variable>

    #{short_description}
  DESCRIPTION
end

.regexpObject



10
11
12
# File 'lib/byebug/commands/untracevar.rb', line 10

def self.regexp
  /^\s* untr(?:acevar)? (?:\s+ (\S+))? \s*$/x
end

.short_descriptionObject



22
23
24
# File 'lib/byebug/commands/untracevar.rb', line 22

def self.short_description
  "Stops tracing a global variable"
end

Instance Method Details

#executeObject



26
27
28
29
30
31
32
33
34
# File 'lib/byebug/commands/untracevar.rb', line 26

def execute
  var = @match[1]
  if global_variables.include?(:"#{var}")
    untrace_var(:"#{var}")
    puts pr("trace.messages.undo", var: var)
  else
    errmsg pr("trace.errors.not_global", var: var)
  end
end