Class: Mutant::Subject Private

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



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

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)


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

def identification
  "#{expression.syntax}:#{source_path}:#{source_line}"
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:



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

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

Returns:



13
14
15
16
17
18
19
# File 'lib/mutant/subject.rb', line 13

def mutations
  [neutral_mutation].concat(
    Mutator.mutate(node).map do |mutant|
      Mutation::Evil.new(self, wrap_node(mutant))
    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)


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

def post_insert
  self
end

#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)


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

def prepare
  self
end

#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)


70
71
72
# File 'lib/mutant/subject.rb', line 70

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

#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)


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

def source_line
  source_lines.begin
end

#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:



46
47
48
49
# File 'lib/mutant/subject.rb', line 46

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)


25
26
27
# File 'lib/mutant/subject.rb', line 25

def source_path
  context.source_path
end