Class: Mutest::Subject Private

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



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

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)


53
54
55
# File 'lib/mutest/subject.rb', line 53

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:



74
# File 'lib/mutest/subject.rb', line 74

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:



11
12
13
14
15
16
17
# File 'lib/mutest/subject.rb', line 11

def mutations
  [neutral_mutation].concat(
    Mutator.mutate(node, context.method(:ignore?)).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

Returns:

  • (self)


30
31
32
# File 'lib/mutest/subject.rb', line 30

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)


61
62
63
# File 'lib/mutest/subject.rb', line 61

def source
  Unparser.unparse(wrap_node(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.

First source line

Returns:

  • (Fixnum)


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

def source_line
  source_lines.begin
end

#source_linesRange<Fixnum>

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:

  • (Range<Fixnum>)


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

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)


23
24
25
# File 'lib/mutest/subject.rb', line 23

def source_path
  context.source_path
end