Module: ActiveSupport::Dependencies::Loadable
- Defined in:
- lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb
Overview
Object includes this module
Class Method Summary collapse
-
.excluded(base) ⇒ Object
:nodoc:.
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#load_with_new_constant_marking(file, *extras) ⇒ Object
:nodoc:.
-
#require(file, *extras) ⇒ Object
:nodoc:.
- #require_association(file_name) ⇒ Object
- #require_dependency(file_name) ⇒ Object
- #require_or_load(file_name) ⇒ Object
-
#unloadable(const_desc) ⇒ Object
Mark the given constant as unloadable.
Class Method Details
.excluded(base) ⇒ Object
:nodoc:
118 119 120 121 122 123 124 125 126 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 118 def self.excluded(base) #:nodoc: base.class_eval do if defined? load_without_new_constant_marking undef_method :load alias_method :load, :load_without_new_constant_marking undef_method :load_without_new_constant_marking end end end |
.included(base) ⇒ Object
:nodoc:
110 111 112 113 114 115 116 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 110 def self.included(base) #:nodoc: base.class_eval do unless defined? load_without_new_constant_marking alias_method_chain :load, :new_constant_marking end end end |
Instance Method Details
#load_with_new_constant_marking(file, *extras) ⇒ Object
:nodoc:
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 140 def load_with_new_constant_marking(file, *extras) #:nodoc: if Dependencies.load? Dependencies.new_constants_in(Object) { load_without_new_constant_marking(file, *extras) } else load_without_new_constant_marking(file, *extras) end rescue Exception => exception # errors from loading file exception.blame_file! file raise end |
#require(file, *extras) ⇒ Object
:nodoc:
151 152 153 154 155 156 157 158 159 160 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 151 def require(file, *extras) #:nodoc: if Dependencies.load? Dependencies.new_constants_in(Object) { super } else super end rescue Exception => exception # errors from required file exception.blame_file! file raise end |
#require_association(file_name) ⇒ Object
136 137 138 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 136 def require_association(file_name) Dependencies.associate_with(file_name) end |
#require_dependency(file_name) ⇒ Object
132 133 134 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 132 def require_dependency(file_name) Dependencies.depend_on(file_name) end |
#require_or_load(file_name) ⇒ Object
128 129 130 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 128 def require_or_load(file_name) Dependencies.require_or_load(file_name) end |
#unloadable(const_desc) ⇒ Object
Mark the given constant as unloadable. Unloadable constants are removed each time dependencies are cleared.
Note that marking a constant for unloading need only be done once. Setup or init scripts may list each unloadable constant that may need unloading; each constant will be removed for every subsequent clear, as opposed to for the first clear.
The provided constant descriptor may be a (non-anonymous) module or class, or a qualified constant name as a string or symbol.
Returns true if the constant was not previously marked for unloading, false otherwise.
175 176 177 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb', line 175 def unloadable(const_desc) Dependencies.mark_for_unload const_desc end |