PERF: avoid regex for hot path
Camelize is called quite a lot in zeitwerk, avoid using a regex here which is far slower than using ends_with?
This commit is contained in:
parent
7a5daa3079
commit
586dfcc795
|
@ -18,8 +18,8 @@ module ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
|
|||
}
|
||||
|
||||
def self.camelize(basename, abspath)
|
||||
return basename.camelize if abspath =~ /onceoff\.rb$/
|
||||
return 'Jobs' if abspath =~ /jobs\/base\.rb$/
|
||||
return basename.camelize if abspath.ends_with?("onceoff.rb")
|
||||
return 'Jobs' if abspath.ends_with?("jobs/base.rb")
|
||||
CUSTOM_PATHS.fetch(basename, basename.camelize)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue