Class: Evilution::Integration::Loading::ConcernStateCleaner Private
- Inherits:
-
Object
- Object
- Evilution::Integration::Loading::ConcernStateCleaner
- Defined in:
- lib/evilution/integration/loading/concern_state_cleaner.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Re-evaluating an ActiveSupport::Concern module raises
"MultipleIncludedBlocks" because AS::Concern records the block source
location on the first include/prepend call. Before a re-eval we clear the
@_included_block / @_prepended_block ivar on modules whose block came
from the file we're about to re-eval.
Constant Summary collapse
- IVARS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%i[@_included_block @_prepended_block].freeze
Instance Method Summary collapse
- #call(file_path) ⇒ Object private
-
#initialize(subpath_resolver: Evilution::LoadPath::SubpathResolver.new) ⇒ ConcernStateCleaner
constructor
private
A new instance of ConcernStateCleaner.
Constructor Details
#initialize(subpath_resolver: Evilution::LoadPath::SubpathResolver.new) ⇒ ConcernStateCleaner
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ConcernStateCleaner.
14 15 16 |
# File 'lib/evilution/integration/loading/concern_state_cleaner.rb', line 14 def initialize(subpath_resolver: Evilution::LoadPath::SubpathResolver.new) @subpath_resolver = subpath_resolver end |
Instance Method Details
#call(file_path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/evilution/integration/loading/concern_state_cleaner.rb', line 18 def call(file_path) return unless defined?(ActiveSupport::Concern) absolute = File.(file_path) subpath = @subpath_resolver.call(file_path) ObjectSpace.each_object(Module) do |mod| next unless mod.singleton_class.ancestors.include?(ActiveSupport::Concern) clear_concern_ivars(mod, absolute, subpath) end end |