Module: Henitai::Mutant::Activator::ConstantRedefinitionFilter

Included in:
Henitai::Mutant::Activator
Defined in:
lib/henitai/mutant/activator.rb

Overview

Filters “already initialized constant” C-level warnings that fire when a source file is loaded into a process that already has the constant defined via require. Uses a thread-local flag so the filter is active only during load_source_file, leaving all other warnings untouched.

Instance Method Summary collapse

Instance Method Details

#warn(msg, **kwargs) ⇒ Object



18
19
20
21
22
# File 'lib/henitai/mutant/activator.rb', line 18

def warn(msg, **kwargs)
  return if Thread.current[:henitai_filter_const_warnings] && PATTERN.match?(msg.to_s)

  super
end