Module: RailsDevelopmentBoost::ReferenceCleanupPatch

Defined in:
lib/rails_development_boost/reference_cleanup_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.apply!Object



3
4
5
6
# File 'lib/rails_development_boost/reference_cleanup_patch.rb', line 3

def self.apply!
  Module.send :include, self
  Module.alias_method_chain :remove_const, :reference_cleanup
end

Instance Method Details

#remove_const_with_reference_cleanup(const_name) ⇒ Object



8
9
10
11
12
# File 'lib/rails_development_boost/reference_cleanup_patch.rb', line 8

def remove_const_with_reference_cleanup(const_name)
  ActiveSupport::Dependencies::Reference.loose!(self == Object ? const_name : "#{_mod_name}::#{const_name}")
  ActiveSupport::DescendantsTracker.delete(const_get(const_name))
  remove_const_without_reference_cleanup(const_name)
end