Class: Evilution::Mutator::Operator::SuperclassRemoval

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

Defined Under Namespace

Classes: ClassFinder

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



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

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

  enclosing = find_target_class(subject)
  return @mutations unless enclosing

  offset, length = superclass_range(enclosing)
  add_mutation(offset: offset, length: length, replacement: "", node: enclosing)

  @mutations
end