Class: ActiveSupport::Reloader
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
self,
ExecutionWrapper,
Callbacks
|
|
| Inherits: |
ActiveSupport::ExecutionWrapper
|
| Defined in: | activesupport/lib/active_support/reloader.rb |
Constant Summary
Callbacks - Included
Class Attribute Summary
- .check rw
- .check? ⇒ Boolean rw
- .executor rw
- .executor? ⇒ Boolean rw
ExecutionWrapper - Inherited
Class Method Summary
-
.after_class_unload(*args, &block)
Registers a callback that will run immediately after the classes are unloaded.
-
.before_class_unload(*args, &block)
Registers a callback that will run immediately before the classes are unloaded.
- .new ⇒ Reloader constructor
-
.reload!
Initiate a manual reload.
-
.to_prepare(*args, &block)
Registers a callback that will run once at application startup and every time the code is reloaded.
-
.wrap
Run the supplied block as a work unit, reloading code as needed.
ExecutionWrapper - Inherited
| .register_hook | Register an object to be invoked during both the |
| .run! | Run this execution. |
| .to_complete, .to_run, | |
| .wrap | Perform the work in the supplied block as an execution. |
DescendantsTracker - Inherited
| clear, descendants, direct_descendants, | |
| store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. |
| subclasses | Alias for DescendantsTracker.direct_descendants. |
Instance Attribute Summary
- #check rw
- #check? ⇒ Boolean rw
- #executor rw
- #executor? ⇒ Boolean rw
ExecutionWrapper - Inherited
Instance Method Summary
-
#release_unload_lock!
Release the unload lock if it has been previously obtained.
-
#require_unload_lock!
Acquire the
Dependencies::Interlockunload lock, ensuring it will be released automatically.
ExecutionWrapper - Inherited
| #complete! | Complete this in-flight execution. |
Callbacks - Included
| #run_callbacks | Runs the callbacks for the given event. |
Constructor Details
.new ⇒ Reloader
# File 'activesupport/lib/active_support/reloader.rb', line 91
def initialize super @locked = false end
Class Attribute Details
.check (rw)
[ GitHub ]# File 'activesupport/lib/active_support/reloader.rb', line 77
class_attribute :check, default: lambda { false }
.check? ⇒ Boolean (rw)
[ GitHub ]
# File 'activesupport/lib/active_support/reloader.rb', line 77
class_attribute :check, default: lambda { false }
.executor (rw)
[ GitHub ]# File 'activesupport/lib/active_support/reloader.rb', line 76
class_attribute :executor, default: Executor
.executor? ⇒ Boolean (rw)
[ GitHub ]
Class Method Details
.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
.reload!
Initiate a manual reload
.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 Attribute Details
#check (rw)
[ GitHub ]# File 'activesupport/lib/active_support/reloader.rb', line 77
class_attribute :check, default: lambda { false }
#check? ⇒ Boolean (rw)
[ GitHub ]
# File 'activesupport/lib/active_support/reloader.rb', line 77
class_attribute :check, default: lambda { false }
#executor (rw)
[ GitHub ]# File 'activesupport/lib/active_support/reloader.rb', line 76
class_attribute :executor, default: Executor
#executor? ⇒ Boolean (rw)
[ GitHub ]
Instance Method Details
#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 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