Class: Mutant::Subject Private

Inherits:
Object
  • Object
show all
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

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



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

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



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

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



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

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



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

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



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

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



65
66
67
# File 'lib/mutant/subject.rb', line 65

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



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

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



41
42
43
44
# File 'lib/mutant/subject.rb', line 41

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



27
28
29
# File 'lib/mutant/subject.rb', line 27

def source_path
  context.source_path
end