Class: Byebug::DeleteDisplayCommand

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

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

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



104
105
106
107
108
109
110
111
112
# File 'lib/byebug/commands/display.rb', line 104

def description
  %{undisp[lay][ nnn]

    Cancel some expressions to be displayed when program stops. Arguments
    are the code numbers of the expressions to stop displaying. No
    argument means cancel all automatic-display expressions. "delete
    display" has the same effect as this command. Do "info display" to see
    the current list of code numbers.}
end

.namesObject



100
101
102
# File 'lib/byebug/commands/display.rb', line 100

def names
  %w(undisplay)
end

Instance Method Details

#executeObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/byebug/commands/display.rb', line 81

def execute
  unless pos = @match[1]
    if confirm('Clear all expressions? (y/n) ')
      for d in @state.display
        d[0] = false
      end
    end
  else
    pos = get_int(pos, 'Undisplay')
    return unless pos
    if @state.display[pos-1]
      @state.display[pos-1][0] = nil
    else
      errmsg "Display expression %d is not defined.\n", pos
    end
  end
end

#regexpObject



77
78
79
# File 'lib/byebug/commands/display.rb', line 77

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