class Byebug::EvalCommand

Evaluation of expressions from byebug's prompt.

Public Class Methods

description() click to toggle source
# File lib/byebug/commands/eval.rb, line 84
def description
  prettify <<-EOD
    e[val] <expression>

    Evaluates <expression> and prints its value.

    * NOTE - unknown input is automatically evaluated, to turn this off
    use 'set noautoeval'.
  EOD
end
names() click to toggle source
# File lib/byebug/commands/eval.rb, line 80
def names
  %w(eval)
end

Public Instance Methods

execute() click to toggle source
# File lib/byebug/commands/eval.rb, line 68
def execute
  expr = @match ? @match.post_match : @input
  run_with_binding do |b|
    res = eval_with_setting(b, expr, Setting[:stack_on_error])

    print pr('eval.result', expr: expr, result: res.inspect)
  end
rescue
  puts "#{$ERROR_INFO.class} Exception: #{$ERROR_INFO.message}"
end
match(input) click to toggle source
Calls superclass method Byebug::Command#match
# File lib/byebug/commands/eval.rb, line 59
def match(input)
  @input = input
  super
end
regexp() click to toggle source
# File lib/byebug/commands/eval.rb, line 64
def regexp
  /^\s* e(?:val)? \s+/x
end