Methods
- after_class_unload
- before_class_unload
- new
- release_unload_lock!
- reload!
- require_unload_lock!
- to_prepare
- wrap
Class Public methods
after_class_unload(*args, &block)
Registers a callback that will run immediately after the classes are unloaded.
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 42
def self.after_class_unload(*args, &block)
set_callback(:class_unload, :after, *args, &block)
end
🔎 See on GitHub
before_class_unload(*args, &block)
Registers a callback that will run immediately before the classes are unloaded.
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 37
def self.before_class_unload(*args, &block)
set_callback(:class_unload, *args, &block)
end
🔎 See on GitHub
new()
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 92
def initialize
super
@locked = false
end
🔎 See on GitHub
reload!()
Initiate a manual reload
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 49
def self.reload!
executor.wrap do
new.tap do |instance|
begin
instance.run!
ensure
instance.complete!
end
end
end
prepare!
end
🔎 See on GitHub
to_prepare(*args, &block)
Registers a callback that will run once at application startup and every time the code is reloaded.
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 32
def self.to_prepare(*args, &block)
set_callback(:prepare, *args, &block)
end
🔎 See on GitHub
wrap()
Run the supplied block as a work unit, reloading code as needed
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 71
def self.wrap
executor.wrap do
super
end
end
🔎 See on GitHub
Instance Public methods
release_unload_lock!()
Release the unload lock if it has been previously obtained
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 107
def release_unload_lock!
if @locked
@locked = false
ActiveSupport::Dependencies.interlock.done_unloading
end
end
🔎 See on GitHub
require_unload_lock!()
Acquire the ActiveSupport::Dependencies::Interlock
unload lock, ensuring it will be released automatically
📝 Source code
# File activesupport/lib/active_support/reloader.rb, line 99
def require_unload_lock!
unless @locked
ActiveSupport::Dependencies.interlock.start_unloading
@locked = true
end
end
🔎 See on GitHub