Class: Mutant::Subject
- Inherits:
-
Object
- Object
- Mutant::Subject
- Includes:
- AbstractType, Adamantium::Flat, Enumerable
- Defined in:
- lib/mutant/subject.rb,
lib/mutant/subject/method.rb,
lib/mutant/subject/method/instance.rb,
lib/mutant/subject/method/singleton.rb
Overview
Subject of a mutation
Direct Known Subclasses
Defined Under Namespace
Classes: Method
Instance Method Summary collapse
-
#expression ⇒ Expression
private
Return match expression.
-
#identification ⇒ String
private
Return subject identification.
-
#match_expressions ⇒ Enumerable<Expression>
private
Return match expressions.
-
#mutations ⇒ Enumerable<Mutation>, undefined
private
Return mutations.
-
#prepare ⇒ self
private
Prepare the subject for the insertion of mutation.
-
#source ⇒ String
private
Return source representation of ast.
-
#source_line ⇒ Fixnum
private
Return source line.
-
#source_lines ⇒ Range<Fixnum>
private
Return source lines.
-
#source_path ⇒ String
private
Return source path.
Instance Method Details
#expression ⇒ Expression
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 match expression
93 |
# File 'lib/mutant/subject.rb', line 93 abstract_method :expression |
#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 subject identification
71 72 73 |
# File 'lib/mutant/subject.rb', line 71 def identification "#{expression.syntax}:#{source_path}:#{source_line}" end |
#match_expressions ⇒ Enumerable<Expression>
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 match expressions
101 |
# File 'lib/mutant/subject.rb', line 101 abstract_method :match_expressions |
#mutations ⇒ Enumerable<Mutation>, undefined
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 mutations
14 15 16 17 18 19 20 |
# File 'lib/mutant/subject.rb', line 14 def mutations mutations = [neutral_mutation] Mutator.each(node) do |mutant| mutations << Mutation::Evil.new(self, wrap_node(mutant)) end mutations end |
#prepare ⇒ 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.
Prepare the subject for the insertion of mutation
39 40 41 |
# File 'lib/mutant/subject.rb', line 39 def prepare self 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 representation of ast
82 83 84 |
# File 'lib/mutant/subject.rb', line 82 def source Unparser.unparse(wrap_node(node)) end |
#source_line ⇒ Fixnum
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 line
61 62 63 |
# File 'lib/mutant/subject.rb', line 61 def source_line source_lines.begin end |
#source_lines ⇒ Range<Fixnum>
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 lines
49 50 51 52 |
# File 'lib/mutant/subject.rb', line 49 def source_lines expression = node.location.expression expression.line..expression.source_buffer.decompose_position(expression.end_pos).first end |
#source_path ⇒ 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 path
29 30 31 |
# File 'lib/mutant/subject.rb', line 29 def source_path context.source_path end |