diff --git a/CHANGELOG.md b/CHANGELOG.md index f5968c0..5e1fa14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## HEAD (unreleased) +- Fix sinatra support for `require_relative` (https://github.com/zombocom/dead_end/pull/63) + ## 1.1.6 - Consider if syntax error caused an unexpected variable instead of end (https://github.com/zombocom/dead_end/pull/58) diff --git a/lib/dead_end/auto.rb b/lib/dead_end/auto.rb index 3e5dbd3..67e23ac 100644 --- a/lib/dead_end/auto.rb +++ b/lib/dead_end/auto.rb @@ -27,7 +27,7 @@ def require_relative(file) if Pathname.new(file).absolute? dead_end_original_require file else - dead_end_original_require File.expand_path("../#{file}", caller_locations(1, 1)[0].absolute_path) + dead_end_original_require File.expand_path("../#{file}", Kernel.caller_locations(1, 1)[0].absolute_path) end rescue SyntaxError => e DeadEnd.handle_error(e)