Class: Byebug::AddDisplayCommand

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

Overview

Implements the functionality of adding custom expressions to be displayed every time the debugger stops.

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



45
46
47
48
49
# File 'lib/byebug/commands/display.rb', line 45

def description
  %(disp[lay] <expression>

    Add <expression> into display expression list.)
end

.namesObject



41
42
43
# File 'lib/byebug/commands/display.rb', line 41

def names
  %w(display)
end

Instance Method Details

#executeObject



34
35
36
37
38
# File 'lib/byebug/commands/display.rb', line 34

def execute
  exp = @match[1]
  @state.display.push [true, exp]
  puts "#{@state.display.size}: #{display_expression(exp)}"
end

#regexpObject



30
31
32
# File 'lib/byebug/commands/display.rb', line 30

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