Module: ActiveSupport::Dependencies
- Defined in:
- lib/bootscale/active_support/core_ext.rb
Instance Method Summary collapse
- #search_for_file(path) ⇒ Object
-
#search_for_file_without_bootscale ⇒ Object
ActiveSupport::Dependencies.search_for_file works pretty much like Kernel#require.
Instance Method Details
#search_for_file(path) ⇒ Object
12 13 14 |
# File 'lib/bootscale/active_support/core_ext.rb', line 12 def search_for_file(path) ::Bootscale::ActiveSupport.cache[path] || search_for_file_without_bootscale(path) end |
#search_for_file_without_bootscale ⇒ Object
ActiveSupport::Dependencies.search_for_file works pretty much like Kernel#require. It has a load path (AS::Dependencies.autoload_paths) and when it’s looking for a file to load it search the load path entries one by one for a match. So just like for Kernel#require, this process is increasingly slow the more load path entries you have, and it can be optimized with exactly the same caching strategy.
10 |
# File 'lib/bootscale/active_support/core_ext.rb', line 10 alias_method :search_for_file_without_bootscale, :search_for_file |