Class: Evilution::Mutator::Operator::MixinRemoval

Inherits:
Base
  • Object
show all
Defined in:
lib/evilution/mutator/operator/mixin_removal.rb

Defined Under Namespace

Classes: ScopeFinder

Constant Summary collapse

MIXIN_METHODS =
%i[include extend prepend].freeze

Instance Attribute Summary

Attributes inherited from Base

#mutations

Instance Method Summary collapse

Methods inherited from Base

clear_parse_cache!, #initialize, operator_name, parsed_tree_for

Constructor Details

This class inherits a constructor from Evilution::Mutator::Base

Instance Method Details

#call(subject, filter: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/evilution/mutator/operator/mixin_removal.rb', line 10

def call(subject, filter: nil)
  @subject = subject
  @file_source = File.read(subject.file_path)
  @mutations = []
  @filter = filter

  enclosing = find_target_scope(subject)
  return @mutations unless enclosing

  find_mixin_calls(enclosing).each { |call_node| emit_mixin_removal(call_node) }
  @mutations
end