class Byebug::AddDisplayCommand - byebug-4.0.5 Documentation

# class Byebug::AddDisplayCommand

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

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/display.rb, line 26
    def description
      prettify <<-EOD
        disp[lay] <expression>

        Add <expression> into display expression list.
      EOD
    end

names() click to toggle source

    # File lib/byebug/commands/display.rb, line 22
    def names
      %w(display)
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/display.rb, line 15
    def execute
      exp = @match[1]
      @state.display.push [true, exp]
      display_expression(exp)
    end

regexp() click to toggle source

    # File lib/byebug/commands/display.rb, line 11
    def regexp
      /^\s* disp(?:lay)? \s+ (.+) \s*$/x
    end

### Private Instance Methods

display_expression(exp) click to toggle source

    # File lib/byebug/commands/display.rb, line 37
    def display_expression(exp)
      print pr('display.result',
               n: @state.display.size,
               exp: exp,
               result: bb_warning_eval(exp).inspect)
    end