Class: Mutant::Mutation
- Inherits:
-
Object
- Object
- Mutant::Mutation
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/mutation.rb,
lib/mutant/mutation/filter.rb,
lib/mutant/mutation/filter/code.rb,
lib/mutant/mutation/filter/regexp.rb,
lib/mutant/mutation/filter/whitelist.rb
Overview
Represent a mutated node with its subject
Direct Known Subclasses
Defined Under Namespace
Instance Attribute Summary collapse
-
#node ⇒ Rubinius::AST::Node
readonly
private
Return mutated node.
-
#subject ⇒ Subject
readonly
private
Return mutation subject.
Instance Method Summary collapse
-
#code ⇒ String
private
Return mutation code.
-
#identification ⇒ String
private
Return identification.
-
#insert ⇒ self
private
Insert mutated node.
-
#original_source ⇒ String
private
Return original source.
-
#root ⇒ Rubinius::AST::Node
private
Return mutated root node.
-
#sha1 ⇒ String
private
Return sha1 sum of source and subject identification.
-
#source ⇒ String
private
Return source.
Instance Attribute Details
#node ⇒ Rubinius::AST::Node (readonly)
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.
Return mutated node
20 21 22 |
# File 'lib/mutant/mutation.rb', line 20 def node @node end |
#subject ⇒ Subject (readonly)
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.
Return mutation subject
12 13 14 |
# File 'lib/mutant/mutation.rb', line 12 def subject @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.
Return mutation code
61 62 63 |
# File 'lib/mutant/mutation.rb', line 61 def code sha1[0..4] end |
#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.
Return identification
50 51 52 |
# File 'lib/mutant/mutation.rb', line 50 def identification "#{subject.identification}:#{code}" end |
#insert ⇒ self
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
39 40 41 42 |
# File 'lib/mutant/mutation.rb', line 39 def insert Loader::Eval.run(root, subject.source_path, subject.source_line) self end |
#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.
Return original source
94 95 96 |
# File 'lib/mutant/mutation.rb', line 94 def original_source subject.source end |
#root ⇒ Rubinius::AST::Node
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.
Return mutated root node
28 29 30 |
# File 'lib/mutant/mutation.rb', line 28 def root subject.root(node) end |
#sha1 ⇒ 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.
Return sha1 sum of source and subject identification
72 73 74 |
# File 'lib/mutant/mutation.rb', line 72 def sha1 Digest::SHA1.hexdigest(subject.identification + source) end |
#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.
Return source
83 84 85 |
# File 'lib/mutant/mutation.rb', line 83 def source ToSource.to_source(node) end |