Class: Mutant::Subject::Method

Inherits:
Mutant::Subject show all
Defined in:
lib/mutant/subject/method.rb,
lib/mutant/subject/method/instance.rb,
lib/mutant/subject/method/singleton.rb

Overview

Abstract base class for method subjects

Direct Known Subclasses

Instance, Singleton

Defined Under Namespace

Classes: Instance, Singleton

Instance Method Summary collapse

Methods inherited from Mutant::Subject

#identification, #mutations, #prepare, #source, #source_line, #source_lines, #source_path

Instance Method Details

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

Match expression

Returns:

  • (String)


27
28
29
30
31
32
33
# File 'lib/mutant/subject/method.rb', line 27

def expression
  Expression::Method.new(
    scope_symbol: self.class::SYMBOL,
    scope_name:   scope.name,
    method_name:  name.to_s
  )
end

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



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

def match_expressions
  [expression].concat(context.match_expressions)
end

#nameExpression

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.

Method name

Returns:



18
19
20
# File 'lib/mutant/subject/method.rb', line 18

def name
  node.children.fetch(self.class::NAME_INDEX)
end

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

Test if method is public

Returns:

  • (Boolean)


11
# File 'lib/mutant/subject/method.rb', line 11

abstract_method :public?