Skip to content

Commit

Permalink
Add RUBY_STDLIB constant to CallerLogging module
Browse files Browse the repository at this point in the history
This avoids unnecessary work inside the caller.find loop.
  • Loading branch information
jeremyevans committed Apr 4, 2024
1 parent e1078c4 commit 559fea3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/sequel/extensions/caller_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
module Sequel
module CallerLogging
SEQUEL_LIB_PATH = (File.expand_path('../../..', __FILE__) + '/').freeze
RUBY_STDLIB = RbConfig::CONFIG["rubylibdir"]

# A regexp of caller lines to ignore, in addition to internal Sequel and Ruby code.
attr_accessor :caller_logging_ignore
Expand All @@ -59,7 +60,7 @@ def external_caller_for_log
ignore = caller_logging_ignore
c = caller.find do |line|
!(line.start_with?(SEQUEL_LIB_PATH) ||
line.start_with?(RbConfig::CONFIG["rubylibdir"]) ||
line.start_with?(RUBY_STDLIB) ||
(ignore && line =~ ignore))
end

Expand Down

0 comments on commit 559fea3

Please sign in to comment.