Class: Byebug::DisplayCommand

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

Overview

Custom expressions to be displayed every time the debugger stops.

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::EvalHelper

#error_eval, #multiple_thread_eval, #separate_thread_eval, #silent_eval, #warning_eval

Methods inherited from Command

#arguments, columnize, #context, #frame, help, #initialize, match, to_s

Methods included from Helpers::StringHelper

#camelize, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

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

    #{short_description}

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

.regexpObject



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

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

.short_descriptionObject



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

def self.short_description
  'Evaluates expressions every time the debugger stops'
end

Instance Method Details

#executeObject



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

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

  Byebug.displays.push [true, @match[1]]
  display_expression(@match[1])
end