Skip to content

Commit

Permalink
Merge pull request #52099 from justinko/issue-52089
Browse files Browse the repository at this point in the history
Do not use SyntaxError#path
  • Loading branch information
rafaelfranca committed Jun 12, 2024
1 parent 2b05f76 commit aa418a0
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions activesupport/lib/active_support/syntax_error_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def backtrace_locations

private
def parse_message_for_trace
if source_location_eval?
if __getobj__.to_s.start_with?("(eval")
# If the exception is coming from a call to eval, we need to keep
# the path of the file in which eval was called to ensure we can
# return the right source fragment to show the location of the
Expand All @@ -56,15 +56,5 @@ def parse_message_for_trace
__getobj__.to_s.split("\n")
end
end

if SyntaxError.method_defined?(:path) # Ruby 3.3+
def source_location_eval?
__getobj__.path.start_with?("(eval")
end
else # 3.2 and older versions of Ruby
def source_location_eval?
__getobj__.to_s.start_with?("(eval")
end
end
end
end

0 comments on commit aa418a0

Please sign in to comment.