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, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

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

    #{short_description}
  EOD
end

.regexpObject



8
9
10
# File 'lib/byebug/commands/untracevar.rb', line 8

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

.short_descriptionObject



20
21
22
# File 'lib/byebug/commands/untracevar.rb', line 20

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

Instance Method Details

#executeObject



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

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