Class: Byebug::InfoCommand::DisplayCommand

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

Overview

Information about display expressions

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

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

Methods included from Helpers::StringHelper

#camelize, #deindent, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

def self.description
  <<-DESCRIPTION
    inf[o] d[display]

    #{short_description}
  DESCRIPTION
end

.regexpObject



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

def self.regexp
  /^\s* d(?:isplay)? \s*$/x
end

.short_descriptionObject



26
27
28
# File 'lib/byebug/commands/info/display.rb', line 26

def self.short_description
  "List of expressions to display when program stops"
end

Instance Method Details

#executeObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/byebug/commands/info/display.rb', line 30

def execute
  return puts("There are no auto-display expressions now.") unless Byebug.displays.find { |d| d[0] }

  puts "Auto-display expressions now in effect:"
  puts "Num Enb Expression"

  Byebug.displays.each_with_index do |d, i|
    interp = format(
      "%<number>3d: %<status>s  %<expression>s",
      number: i + 1,
      status: d[0] ? "y" : "n",
      expression: d[1]
    )

    puts(interp)
  end
end