Class: Byebug::DisplayCommand

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

Overview

Custom expressions to be displayed every time the debugger stops.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#help, #initialize, #match, subcommands, to_name

Methods included from Helpers::StringHelper

#camelize, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.always_runObject



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

def self.always_run
  2
end

Instance Method Details

#descriptionObject



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

def description
  <<-EOD
    disp[lay][ <expression>]

    If <expression> specified, adds <expression> into display expression
    list. Otherwise, it lists all expressions.
  EOD
end

#executeObject



18
19
20
21
22
23
# File 'lib/byebug/commands/display.rb', line 18

def execute
  return print_display_expressions unless @match && @match[1]

  @state.display.push [true, @match[1]]
  display_expression(@match[1])
end

#regexpObject



14
15
16
# File 'lib/byebug/commands/display.rb', line 14

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