Skip to Content Skip to Search
Methods
A
B
N
R
T
W

Class Public methods

after_class_unload(*args, &block)

Registers a callback that will run immediately after the classes are unloaded.

# File activesupport/lib/active_support/reloader.rb, line 43
def self.after_class_unload(*args, &block)
  set_callback(:class_unload, :after, *args, &block)
end

before_class_unload(*args, &block)

Registers a callback that will run immediately before the classes are unloaded.

# File activesupport/lib/active_support/reloader.rb, line 38
def self.before_class_unload(*args, &block)
  set_callback(:class_unload, *args, &block)
end

new()

# File activesupport/lib/active_support/reloader.rb, line 91
def initialize
  super
  @locked = false
end

reload!()

Initiate a manual reload

# File activesupport/lib/active_support/reloader.rb, line 50
def self.reload!
  executor.wrap do
    new.tap do |instance|
      instance.run!
    ensure
      instance.complete!
    end
  end
  prepare!
end

to_prepare(*args, &block)

Registers a callback that will run once at application startup and every time the code is reloaded.

# File activesupport/lib/active_support/reloader.rb, line 33
def self.to_prepare(*args, &block)
  set_callback(:prepare, *args, &block)
end

wrap()

Run the supplied block as a work unit, reloading code as needed

# File activesupport/lib/active_support/reloader.rb, line 70
def self.wrap
  executor.wrap do
    super
  end
end

Instance Public methods

release_unload_lock!()

Release the unload lock if it has been previously obtained

# File activesupport/lib/active_support/reloader.rb, line 106
def release_unload_lock!
  if @locked
    @locked = false
    ActiveSupport::Dependencies.interlock.done_unloading
  end
end

require_unload_lock!()

Acquire the ActiveSupport::Dependencies::Interlock unload lock, ensuring it will be released automatically

# File activesupport/lib/active_support/reloader.rb, line 98
def require_unload_lock!
  unless @locked
    ActiveSupport::Dependencies.interlock.start_unloading
    @locked = true
  end
end