Class: Mutant::Mutation Private
- Inherits:
-
Object
- Object
- Mutant::Mutation
- Includes:
- Unparser::AbstractType, Unparser::Adamantium
- Defined in:
- lib/mutant/mutation.rb,
lib/mutant/mutation/config.rb,
lib/mutant/mutation/runner.rb,
lib/mutant/mutation/operators.rb,
lib/mutant/mutation/runner/sink.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.
Represent a mutated node with its subject
Defined Under Namespace
Modules: Runner Classes: Config, Evil, GenerationError, Neutral, Noop, Operators
Constant Summary collapse
- CODE_DELIMITER =
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.
"\0"- CODE_RANGE =
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.
(..4)
Class Method Summary collapse
-
.from_node(subject:, node:) ⇒ Object
private
GenerationError.
Instance Method Summary collapse
-
#code ⇒ String
private
Mutation identification code.
- #diff ⇒ Object private
-
#identification ⇒ String
private
Identification string.
-
#insert(kernel) ⇒ Loader::Result
private
Insert mutated node.
-
#monkeypatch ⇒ String
private
The monkeypatch to insert the mutation.
-
#original_source ⇒ String
private
Normalized original source.
Class Method Details
.from_node(subject:, node:) ⇒ 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.
GenerationError
61 62 63 64 65 66 67 68 |
# File 'lib/mutant/mutation.rb', line 61 def self.from_node(subject:, node:) ast = Unparser::AST.from_node(node:) Unparser .unparse_validate_ast_either(ast:) .lmap { |unparser_validation| GenerationError.new(subject:, node:, unparser_validation:) } .fmap { |source| new(node:, source:, subject:) } end |
Instance Method Details
#code ⇒ String
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.
Mutation identification code
73 |
# File 'lib/mutant/mutation.rb', line 73 def code = sha1[CODE_RANGE] |
#diff ⇒ 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.
111 |
# File 'lib/mutant/mutation.rb', line 111 def diff = Unparser::Diff.build(original_source, source) |
#identification ⇒ String
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.
Identification string
79 |
# File 'lib/mutant/mutation.rb', line 79 def identification = "#{self.class::SYMBOL}:#{subject.identification}:#{code}" |
#insert(kernel) ⇒ Loader::Result
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.
Insert mutated node
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/mutant/mutation.rb', line 98 def insert(kernel) subject.prepare Loader.call( binding: TOPLEVEL_BINDING, kernel:, source: monkeypatch, subject: ).fmap do subject.post_insert nil end end |
#monkeypatch ⇒ String
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.
The monkeypatch to insert the mutation
85 |
# File 'lib/mutant/mutation.rb', line 85 def monkeypatch = Unparser.unparse(subject.context.root(node)) |
#original_source ⇒ String
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.
Normalized original source
91 |
# File 'lib/mutant/mutation.rb', line 91 def original_source = subject.source |