Skip to content

Commit 132049b

Browse files
committed
Improve deprecation warning location detection
1 parent db4c428 commit 132049b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/json/common.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def create_additions_warning
9696
end
9797

9898
class << self
99-
def deprecation_warning(message, uplevel = 4) # :nodoc:
99+
def deprecation_warning(message, uplevel = 3) # :nodoc:
100100
gem_root = File.expand_path("../../../", __FILE__) + "/"
101101
caller_locations(uplevel, 10).each do |frame|
102102
if frame.path.nil? || frame.path.start_with?(gem_root) || frame.path.end_with?("/truffle/cext_ruby.rb", ".c")
@@ -107,9 +107,9 @@ def deprecation_warning(message, uplevel = 4) # :nodoc:
107107
end
108108

109109
if RUBY_VERSION >= "3.0"
110-
warn(message, uplevel: uplevel - 1, category: :deprecated)
110+
warn(message, uplevel: uplevel, category: :deprecated)
111111
else
112-
warn(message, uplevel: uplevel - 1)
112+
warn(message, uplevel: uplevel)
113113
end
114114
end
115115

0 commit comments

Comments
 (0)