Class: Evilution::Mutation
- Inherits:
-
Object
- Object
- Evilution::Mutation
- Defined in:
- lib/evilution/mutation.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#mutated_slice ⇒ Object
readonly
Returns the value of attribute mutated_slice.
-
#mutated_source ⇒ Object
readonly
Returns the value of attribute mutated_source.
-
#operator_name ⇒ Object
readonly
Returns the value of attribute operator_name.
-
#original_slice ⇒ Object
readonly
Returns the value of attribute original_slice.
-
#original_source ⇒ Object
readonly
Returns the value of attribute original_source.
-
#parse_status ⇒ Object
readonly
Returns the value of attribute parse_status.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #diff ⇒ Object
-
#initialize(subject:, operator_name:, original_source:, mutated_source:, file_path:, line:, column: 0, original_slice: nil, mutated_slice: nil, parse_status: :ok) ⇒ Mutation
constructor
rubocop:disable Metrics/ParameterLists.
- #strip_sources! ⇒ Object
- #to_s ⇒ Object
- #unified_diff ⇒ Object
- #unparseable? ⇒ Boolean
Constructor Details
#initialize(subject:, operator_name:, original_source:, mutated_source:, file_path:, line:, column: 0, original_slice: nil, mutated_slice: nil, parse_status: :ok) ⇒ Mutation
rubocop:disable Metrics/ParameterLists
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/evilution/mutation.rb', line 11 def initialize(subject:, operator_name:, original_source:, mutated_source:, file_path:, line:, column: 0, original_slice: nil, mutated_slice: nil, parse_status: :ok) # rubocop:enable Metrics/ParameterLists @subject = subject @operator_name = operator_name @original_source = original_source @mutated_source = mutated_source @original_slice = original_slice @mutated_slice = mutated_slice @file_path = file_path @line = line @column = column @parse_status = parse_status @diff = nil end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def column @column end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def file_path @file_path end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def line @line end |
#mutated_slice ⇒ Object (readonly)
Returns the value of attribute mutated_slice.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def mutated_slice @mutated_slice end |
#mutated_source ⇒ Object (readonly)
Returns the value of attribute mutated_source.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def mutated_source @mutated_source end |
#operator_name ⇒ Object (readonly)
Returns the value of attribute operator_name.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def operator_name @operator_name end |
#original_slice ⇒ Object (readonly)
Returns the value of attribute original_slice.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def original_slice @original_slice end |
#original_source ⇒ Object (readonly)
Returns the value of attribute original_source.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def original_source @original_source end |
#parse_status ⇒ Object (readonly)
Returns the value of attribute parse_status.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def parse_status @parse_status end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
6 7 8 |
# File 'lib/evilution/mutation.rb', line 6 def subject @subject end |
Instance Method Details
#diff ⇒ Object
32 33 34 |
# File 'lib/evilution/mutation.rb', line 32 def diff @diff ||= compute_diff end |
#strip_sources! ⇒ Object
42 43 44 45 46 |
# File 'lib/evilution/mutation.rb', line 42 def strip_sources! diff # ensure diff is cached before clearing sources @original_source = nil @mutated_source = nil end |
#to_s ⇒ Object
94 95 96 |
# File 'lib/evilution/mutation.rb', line 94 def to_s "#{operator_name}: #{file_path}:#{line}" end |
#unified_diff ⇒ Object
36 37 38 39 40 |
# File 'lib/evilution/mutation.rb', line 36 def unified_diff return @unified_diff if defined?(@unified_diff) @unified_diff = compute_unified_diff end |
#unparseable? ⇒ Boolean
28 29 30 |
# File 'lib/evilution/mutation.rb', line 28 def unparseable? @parse_status == :unparseable end |