mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 20:08:26 +00:00
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)
|
def self.camelize(basename, abspath)
|
||||||
return basename.camelize if abspath =~ /onceoff\.rb$/
|
return basename.camelize if abspath.ends_with?("onceoff.rb")
|
||||||
return 'Jobs' if abspath =~ /jobs\/base\.rb$/
|
return 'Jobs' if abspath.ends_with?("jobs/base.rb")
|
||||||
CUSTOM_PATHS.fetch(basename, basename.camelize)
|
CUSTOM_PATHS.fetch(basename, basename.camelize)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user