lib/byebug/helpers/eval.rb in byebug-9.1.0 vs lib/byebug/helpers/eval.rb in byebug-10.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Byebug
module Helpers
#
# Utilities to assist evaluation of code strings
#
@@ -54,19 +56,19 @@
end
private
def safe_eval(str, binding)
- binding.eval(str.gsub(/\Aeval /, ''), '(byebug)', 1)
+ binding.eval(str.gsub(/\Aeval /, ""), "(byebug)", 1)
rescue StandardError, ScriptError => e
yield(e)
end
def msg(e)
msg = Setting[:stack_on_error] ? error_msg(e) : warning_msg(e)
- pr('eval.exception', text_message: msg)
+ pr("eval.exception", text_message: msg)
end
def error_msg(e)
at = e.backtrace
@@ -96,11 +98,11 @@
res
end
#
# Runs the given block in a new thread, waits for it to finish and
- # returns the new thred's result.
+ # returns the new thread's result.
#
def in_new_thread
res = nil
Thread.new { res = yield }.join
@@ -108,17 +110,17 @@
res
end
def safe_inspect(var)
var.inspect
- rescue
+ rescue StandardError
safe_to_s(var)
end
def safe_to_s(var)
var.to_s
- rescue
- '*Error in evaluation*'
+ rescue StandardError
+ "*Error in evaluation*"
end
end
end
end