Module: ActiveSupport::Dependencies
- Defined in:
- lib/require_hooks.rb
Defined Under Namespace
Modules: Loadable
Instance Method Summary collapse
- #after_require(file_name, &block) ⇒ Object
- #before_require(file_name, &block) ⇒ Object
- #require_or_load_with_load_hooks(file_name) ⇒ Object
Instance Method Details
#after_require(file_name, &block) ⇒ Object
14 15 16 17 |
# File 'lib/require_hooks.rb', line 14 def after_require(file_name, &block) resolved = search_for_file(file_name) || file_name ActiveSupport.on_load("after_#{resolved}", :yield => true, &block) end |
#before_require(file_name, &block) ⇒ Object
9 10 11 12 |
# File 'lib/require_hooks.rb', line 9 def before_require(file_name, &block) resolved = search_for_file(file_name) || file_name ActiveSupport.on_load("before_#{resolved}", :yield => true, &block) end |
#require_or_load_with_load_hooks(file_name) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/require_hooks.rb', line 19 def require_or_load_with_load_hooks(file_name) resolved = search_for_file(file_name) || file_name ActiveSupport.run_load_hooks("before_#{resolved}") require_or_load_without_load_hooks(file_name) ActiveSupport.run_load_hooks("after_#{resolved}") end |