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



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

def description
  prettify "    disp[lay] <expression>\n\n    Add <expression> into display expression list.\n  EOD\nend\n"

.namesObject



22
23
24
# File 'lib/byebug/commands/display.rb', line 22

def names
  %w(display)
end

Instance Method Details

#executeObject



15
16
17
18
19
# File 'lib/byebug/commands/display.rb', line 15

def execute
  exp = @match[1]
  @state.display.push [true, exp]
  display_expression(exp)
end

#regexpObject



11
12
13
# File 'lib/byebug/commands/display.rb', line 11

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