File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -302,13 +302,26 @@ def shush_backtraces
302
302
Kernel . module_eval do
303
303
old_raise = Kernel . method ( :raise )
304
304
remove_method :raise
305
- define_method :raise do |*args , **kwargs |
306
- begin
307
- old_raise . call ( *args , **kwargs )
308
- ensure
309
- if $!
310
- lib = File . expand_path ( ".." , __FILE__ )
311
- $!. backtrace . reject! { |line | line . start_with? ( lib ) } unless $!. backtrace . frozen?
305
+ if Gem ::Version . new ( RUBY_VERSION ) >= Gem ::Version . new ( '3.2.0' )
306
+ define_method :raise do |*args , **kwargs |
307
+ begin
308
+ old_raise . call ( *args , **kwargs )
309
+ ensure
310
+ if $!
311
+ lib = File . expand_path ( ".." , __FILE__ )
312
+ $!. backtrace . reject! { |line | line . start_with? ( lib ) } unless $!. backtrace . frozen?
313
+ end
314
+ end
315
+ end
316
+ else
317
+ define_method :raise do |*args |
318
+ begin
319
+ old_raise . call ( *args )
320
+ ensure
321
+ if $!
322
+ lib = File . expand_path ( ".." , __FILE__ )
323
+ $!. backtrace . reject! { |line | line . start_with? ( lib ) } unless $!. backtrace . frozen?
324
+ end
312
325
end
313
326
end
314
327
end
You can’t perform that action at this time.
0 commit comments