Class: Mutant::Subject Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Unparser::AbstractType, Unparser::Adamantium
Defined in:
lib/mutant/subject.rb,
lib/mutant/subject/config.rb,
lib/mutant/subject/method.rb,
lib/mutant/subject/method/instance.rb,
lib/mutant/subject/method/metaclass.rb,
lib/mutant/subject/method/singleton.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.

Subject of a mutation

Direct Known Subclasses

Method

Defined Under Namespace

Classes: Config, Method

Instance Method Summary collapse

Instance Method Details

#expressionExpression

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.

Match expression

Returns:



81
# File 'lib/mutant/subject.rb', line 81

abstract_method :expression

#identificationString

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

Returns:

  • (String)


69
# File 'lib/mutant/subject.rb', line 69

def identification = "#{expression.syntax}:#{source_path}:#{source_line}"

#inline_disabled?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.

Returns:

  • (Boolean)


33
34
35
# File 'lib/mutant/subject.rb', line 33

def inline_disabled?
  config.inline_disable
end

#match_expressionsEnumerable<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.

Match expressions

Returns:



86
# File 'lib/mutant/subject.rb', line 86

abstract_method :match_expressions

#mutationsEnumerable<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.

Mutations for this subject

mutant:disable rubocop:disable Metrics/MethodLength

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/mutant/subject.rb', line 16

def mutations
  [neutral_mutation].concat(
    Mutator::Node.mutate(
      config: config.mutation,
      node:
    ).each_with_object([]) do |mutant, aggregate|
      Mutation::Evil
        .from_node(subject: self, node: wrap_node(mutant))
        .either(
          ->(validation) {},
          aggregate.public_method(:<<)
        )
    end
  )
end

#post_insertself

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.

Perform post insert cleanup

Returns:

  • (self)


50
# File 'lib/mutant/subject.rb', line 50

def post_insert = self

#prepareself

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 subject for insertion of mutation

Returns:

  • (self)


45
# File 'lib/mutant/subject.rb', line 45

def prepare = self

#sourceString

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 representation of AST

Returns:

  • (String)


75
# File 'lib/mutant/subject.rb', line 75

def source = Unparser.unparse(wrap_node(node))

#source_lineInteger

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.

First source line

Returns:

  • (Integer)


64
# File 'lib/mutant/subject.rb', line 64

def source_line = source_lines.begin

#source_linesRange<Integer>

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 line range

Returns:



55
56
57
58
# File 'lib/mutant/subject.rb', line 55

def source_lines
  expression = node.location.expression
  expression.line..expression.source_buffer.decompose_position(expression.end_pos).first
end

#source_pathPathname

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 path

Returns:

  • (Pathname)


40
# File 'lib/mutant/subject.rb', line 40

def source_path = context.source_path