class Byebug::EvalCommand


Evaluation of expressions from byebug’s prompt.

def description

def description
  %{(p|e[val]) <expression>
    Evaluates <expression> and prints its value.
    * NOTE - unknown input is automatically evaluated, to turn this off
    use 'set noautoeval'.}
end

def execute

def execute
  expr = @match ? @match.post_match : @input
  run_with_binding do |b|
    if Setting[:stack_on_error]
      puts "#{bb_eval(expr, b).inspect}"
    else
      puts "#{bb_warning_eval(expr, b).inspect}"
    end
  end
rescue
  puts "#{$ERROR_INFO.class} Exception: #{$ERROR_INFO.message}"
end

def match(input)

def match(input)
  @input = input
  super
end

def names

def names
  %w(p eval)
end

def regexp

def regexp
  /^\s* (p|e(?:val)?)\s+/x
end