Module: Debugger::EvalFunctions

Included in:
PSCommand
Defined in:
lib/ruby-debug/commands/eval.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#run_with_bindingObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ruby-debug/commands/eval.rb', line 3

def run_with_binding
  binding = @state.context ? get_binding : TOPLEVEL_BINDING
  $__dbg_interface = @state.interface
  eval(<<-EOC, binding)
    __dbg_verbose_save=$VERBOSE; $VERBOSE=false
    def dbg_print(*args)
      $__dbg_interface.print(*args)
    end
    remove_method :puts if self.respond_to?(:puts) &&
      defined?(remove_method)
    def dbg_puts(*args)
      $__dbg_interface.print(*args)
      $__dbg_interface.print("\n")
    end
    $VERBOSE=__dbg_verbose_save
  EOC
  yield binding
ensure
  $__dbg_interface = nil
end