Remove redundant Configuration#in_app_pattern

This commit is contained in:
Sijawusz Pur Rahnama 2020-12-30 22:13:51 +01:00
parent 8ad814c7c1
commit c41fcb5d28
2 changed files with 4 additions and 9 deletions

View file

@ -91,9 +91,9 @@ module Backtracer
# Returns `true` if this frame originated from the app source code, # Returns `true` if this frame originated from the app source code,
# `false` otherwise. # `false` otherwise.
# #
# See `Configuration#in_app_pattern` # See `Configuration#app_dirs_pattern`
def in_app? : Bool def in_app? : Bool
!!(path.try(&.matches?(configuration.in_app_pattern))) !!(relative_path.try(&.matches?(configuration.app_dirs_pattern)))
end end
# Returns a tuple consisting of 3 elements - an array of context lines # Returns a tuple consisting of 3 elements - an array of context lines

View file

@ -53,7 +53,7 @@ module Backtracer
/^(?<method>.+?)$/, /^(?<method>.+?)$/,
} }
# Used in `#in_app_pattern`. # Path considered as "root" of your project.
# #
# See `Frame#under_src_path?` # See `Frame#under_src_path?`
property src_path : String? = {{ Process::INITIAL_PWD }} property src_path : String? = {{ Process::INITIAL_PWD }}
@ -63,12 +63,7 @@ module Backtracer
# to set this to something like `/(src|engines)/` # to set this to something like `/(src|engines)/`
# #
# See `Frame#in_app?` # See `Frame#in_app?`
property app_dirs_pattern = /src/ property app_dirs_pattern = /^src\//
# `Regex` pattern matched against `Backtrace::Frame#path`.
#
# See `Frame#in_app?`
property in_app_pattern : Regex { /^(#{src_path}\/)?(#{app_dirs_pattern})/ }
# Path pattern matching directories to be recognized as your app modules. # Path pattern matching directories to be recognized as your app modules.
# Defaults to standard Shards setup (`lib/shard-name/...`). # Defaults to standard Shards setup (`lib/shard-name/...`).