Class: Evilution::Mutation Private
- Inherits:
-
Object
- Object
- Evilution::Mutation
- Defined in:
- lib/evilution/mutation.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: Location, Slice, Sources
Instance Attribute Summary collapse
- #location ⇒ Object readonly private
- #operator_name ⇒ Object readonly private
- #parse_status ⇒ Object readonly private
- #subject ⇒ Object readonly private
Instance Method Summary collapse
- #column ⇒ Object private
- #diff ⇒ Object private
-
#eval_source ⇒ Object
private
Source to feed to the load-time evaluator.
- #file_path ⇒ Object private
-
#initialize(subject:, operator_name:, sources:, location:, slice: nil, parse_status: :ok, eval_source: nil) ⇒ Mutation
constructor
private
A new instance of Mutation.
- #line ⇒ Object private
- #mutated_slice ⇒ Object private
- #mutated_source ⇒ Object private
- #original_slice ⇒ Object private
- #original_source ⇒ Object private
- #strip_sources! ⇒ Object private
- #to_s ⇒ Object private
- #unified_diff ⇒ Object private
- #unparseable? ⇒ Boolean private
Constructor Details
#initialize(subject:, operator_name:, sources:, location:, slice: nil, parse_status: :ok, eval_source: nil) ⇒ Mutation
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.
Returns a new instance of Mutation.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/evilution/mutation.rb', line 13 def initialize(subject:, operator_name:, sources:, location:, slice: nil, parse_status: :ok, eval_source: nil) @subject = subject @operator_name = operator_name @sources = sources @location = location @slice = slice @parse_status = parse_status @eval_source = eval_source @diff = nil end |
Instance Attribute Details
#location ⇒ Object (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.
11 12 13 |
# File 'lib/evilution/mutation.rb', line 11 def location @location end |
#operator_name ⇒ Object (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.
11 12 13 |
# File 'lib/evilution/mutation.rb', line 11 def operator_name @operator_name end |
#parse_status ⇒ Object (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.
11 12 13 |
# File 'lib/evilution/mutation.rb', line 11 def parse_status @parse_status end |
#subject ⇒ Object (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.
11 12 13 |
# File 'lib/evilution/mutation.rb', line 11 def subject @subject end |
Instance Method Details
#column ⇒ 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.
59 60 61 |
# File 'lib/evilution/mutation.rb', line 59 def column @location.column end |
#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.
67 68 69 |
# File 'lib/evilution/mutation.rb', line 67 def diff @diff ||= compute_diff end |
#eval_source ⇒ 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.
Source to feed to the load-time evaluator. Defaults to mutated_source
when no pre-eval transform was applied at generation time. Mutator::Base
populates this with the neutralized version (top-level idempotency-
violating calls replaced with nil) so the worker eval doesn't re-run
them. The neutralization Prism parse happens once at generation time,
not per worker iteration.
39 40 41 |
# File 'lib/evilution/mutation.rb', line 39 def eval_source @eval_source || mutated_source end |
#file_path ⇒ 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.
51 52 53 |
# File 'lib/evilution/mutation.rb', line 51 def file_path @location.file_path end |
#line ⇒ 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.
55 56 57 |
# File 'lib/evilution/mutation.rb', line 55 def line @location.line end |
#mutated_slice ⇒ 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.
47 48 49 |
# File 'lib/evilution/mutation.rb', line 47 def mutated_slice @slice&.mutated end |
#mutated_source ⇒ 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.
29 30 31 |
# File 'lib/evilution/mutation.rb', line 29 def mutated_source @sources&.mutated end |
#original_slice ⇒ 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.
43 44 45 |
# File 'lib/evilution/mutation.rb', line 43 def original_slice @slice&.original end |
#original_source ⇒ 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.
25 26 27 |
# File 'lib/evilution/mutation.rb', line 25 def original_source @sources&.original end |
#strip_sources! ⇒ 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.
77 78 79 80 |
# File 'lib/evilution/mutation.rb', line 77 def strip_sources! diff # ensure diff is cached before clearing sources @sources = nil end |
#to_s ⇒ 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.
82 83 84 |
# File 'lib/evilution/mutation.rb', line 82 def to_s "#{operator_name}: #{file_path}:#{line}" end |
#unified_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.
71 72 73 74 75 |
# File 'lib/evilution/mutation.rb', line 71 def unified_diff return @unified_diff if defined?(@unified_diff) @unified_diff = compute_unified_diff end |
#unparseable? ⇒ Boolean
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.
63 64 65 |
# File 'lib/evilution/mutation.rb', line 63 def unparseable? @parse_status == :unparseable end |