Class: Mutant::Subject

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

Subject of a mutation

Direct Known Subclasses

Method, Zombifier::Subject

Defined Under Namespace

Classes: Method

Instance Method Summary collapse

Instance Method Details

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

Return subject identification

Returns:

  • (String)


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

def identification
  "#{match_expression}:#{source_path}:#{source_line}"
end

#match_expressionString

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.

Return match expression

Returns:

  • (String)


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

abstract_method :match_expression

#match_prefixesEnumerable<String>

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.

Return match prefixes

Returns:

  • (Enumerable<String>)


101
102
103
# File 'lib/mutant/subject.rb', line 101

def match_prefixes
  [match_expression].concat(context.match_prefixes)
end

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

Return mutations

Returns:



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

def mutations
  mutations = []
  generate_mutations(mutations)
  mutations
end

#original_rootParser::AST::Node

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.

Return root AST node for original AST ndoe

Returns:

  • (Parser::AST::Node)


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

def original_root
  root(node)
end

#root(node) ⇒ Parser::AST::Node

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.

Return root AST for node

Parameters:

  • node (Parser::AST::Node)

Returns:

  • (Parser::AST::Node)


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

def root(node)
  context.root(node)
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.

Return source representation of ast

Returns:

  • (String)


59
60
61
# File 'lib/mutant/subject.rb', line 59

def source
  Unparser.unparse(node)
end

#source_lineFixnum

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.

Return source line

Returns:

  • (Fixnum)


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

def source_line
  node.location.expression.line
end

#source_pathString

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.

Return source path

Returns:

  • (String)


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

def source_path
  context.source_path
end