Class: Byebug::DeleteDisplayCommand

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

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, #print_subcmds, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.help(cmd) ⇒ Object



110
111
112
113
114
115
116
117
118
119
# File 'lib/byebug/commands/display.rb', line 110

def help(cmd)
  %{
    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 current list of code numbers.
  }
end

.help_commandObject



106
107
108
# File 'lib/byebug/commands/display.rb', line 106

def help_command
  'undisplay'
end

Instance Method Details

#executeObject



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/byebug/commands/display.rb', line 87

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



83
84
85
# File 'lib/byebug/commands/display.rb', line 83

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