Class: Byebug::UntracevarCommand

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

Overview

Stop tracing a global variable.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match

Methods included from StringFunctions

#camelize, #prettify

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Methods included from ParseFunctions

#get_int, #parse_steps, #syntax_valid?

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject


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

def description
  prettify <<-EOD
    untr[acevar] <variable>

    Stop tracing global variable <variable>.
  EOD
end

.namesObject


25
26
27
# File 'lib/byebug/commands/untracevar.rb', line 25

def names
  %w(untracevar)
end

Instance Method Details

#executeObject


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

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

#regexpObject


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

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