Method: ActiveSupport::LazyLoadHooks#on_load
- Defined in:
- activesupport/lib/active_support/lazy_load_hooks.rb
#on_load(name, options = {}, &block) ⇒ Object
Declares a block that will be executed when a Rails component is fully loaded. If the component has already loaded, the block is executed immediately.
Options:
-
:yield
- Yields the object that run_load_hooks toblock
. -
:run_once
- Givenblock
will run only once.
60 61 62 63 64 65 66 |
# File 'activesupport/lib/active_support/lazy_load_hooks.rb', line 60 def on_load(name, = {}, &block) @loaded[name].each do |base| execute_hook(name, base, , block) end @load_hooks[name] << [block, ] end |