Class: Rails::Application
- Inherits:
-
Object
- Object
- Rails::Application
- Defined in:
- lib/component/framework/railtie.rb
Overview
Monkeypatch Rails::Application to remove components tests from application’s eager load.
Instance Method Summary collapse
-
#eager_load! ⇒ Object
method adopted from Rails::Engine.eager_load!.
Instance Method Details
#eager_load! ⇒ Object
method adopted from Rails::Engine.eager_load!
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/component/framework/railtie.rb', line 6 def eager_load! config.eager_load_paths.each do |load_path| matcher = /\A#{Regexp.escape(load_path.to_s)}\/(.*)\.rb\Z/ Dir.glob("#{load_path}/**/*.rb") .reject { |p| p.include?("/test/") } .reject { |p| p.include?("/migrations/") } .sort.each do |file| require_dependency file.sub(matcher, '\1') end end end |