class Byebug::DisplayCommand
Custom expressions to be displayed every time the debugger stops.
def self.always_run
def self.always_run 2 end
def description
def description <<-EOD disp[lay][ <expression>] If <expression> specified, adds <expression> into display expression list. Otherwise, it lists all expressions. EOD end
def display_expression(exp)
def display_expression(exp) print pr('display.result', n: @state.display.size, exp: exp, result: bb_warning_eval(exp).inspect) end
def execute
def execute return print_display_expressions unless @match && @match[1] @state.display.push [true, @match[1]] display_expression(@match[1]) end
def print_display_expressions
def print_display_expressions result = prc('display.result', @state.display) do |item, index| is_active, expression = item if is_active { n: index + 1, exp: expression, result: bb_warning_eval(expression).inspect } end end print result end
def regexp
def regexp /^\s* disp(?:lay)? (?:\s+ (.+))? \s*$/x end