class ActiveSupport::Reloader

Parent:
ActiveSupport::ExecutionWrapper

Public Class Methods

after_class_unload(*args, &block) Show source
# File activesupport/lib/active_support/reloader.rb, line 37
def self.after_class_unload(*args, &block)
  set_callback(:class_unload, :after, *args, &block)
end
before_class_unload(*args, &block) Show source
# File activesupport/lib/active_support/reloader.rb, line 33
def self.before_class_unload(*args, &block)
  set_callback(:class_unload, *args, &block)
end
new() Show source
# File activesupport/lib/active_support/reloader.rb, line 90
def initialize
  super
  @locked = false
end
Calls superclass method
reload!() Show source
# File activesupport/lib/active_support/reloader.rb, line 44
def self.reload!
  executor.wrap do
    new.tap do |instance|
      begin
        instance.run!
      ensure
        instance.complete!
      end
    end
  end
  prepare!
end

Initiate a manual reload

to_prepare(*args, &block) Show source
# File activesupport/lib/active_support/reloader.rb, line 29
def self.to_prepare(*args, &block)
  set_callback(:prepare, *args, &block)
end
wrap() Show source
# File activesupport/lib/active_support/reloader.rb, line 66
def self.wrap
  executor.wrap do
    super
  end
end

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

Calls superclass method ActiveSupport::ExecutionWrapper.wrap

Public Instance Methods

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

Release the unload lock if it has been previously obtained

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

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

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.