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

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

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.

Defined Under Namespace

Classes: ScopeFinder

Constant Summary collapse

MIXIN_METHODS =

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[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

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.



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