module Ripl::Debug
Constants
- VERSION
Public Instance Methods
_capture_stds() { || ... }
click to toggle source
# File lib/ripl/debug.rb, line 13 def _capture_stds(&block) original_stdout, original_stderr = $stdout, $stderr $stdout = fake = StringIO.new $stderr = fake2 = StringIO.new begin yield ensure $stdout, $stderr = original_stdout, original_stderr end fake.string + fake2.string end
_valid_syntax?(input)
click to toggle source
# File lib/ripl/debug.rb, line 25 def _valid_syntax?(input) _capture_stds { eval(input, @binding, "ripl-debug syntax check", @line) } rescue SyntaxError false rescue Exception true else true end
before_loop()
click to toggle source
Calls superclass method
# File lib/ripl/debug.rb, line 7 def before_loop super require 'ruby-debug' Debugger.run_init_script(StringIO.new) end
loop_eval(input)
click to toggle source
Calls superclass method
# File lib/ripl/debug.rb, line 35 def loop_eval(input) if config[:debug] && _valid_syntax?(input) # move local variables outside of with_post_mortem input = (set_var_string = input.to_s[/^\s*\w+\s*=\s+/]) ? "#{set_var_string} with_post_mortem { #{input.sub(set_var_string, '')} }" : "with_post_mortem { #{input} }" end super(input) end