free_mutant/lib/mutant/subject/method.rb
Markus Schirp 70b4230399 Drop Subject#public?
* A relict from the days where test selection depended on this
  information
* Kill mutations in Mutation#insert, also very old code.
2015-10-31 01:27:57 +00:00

52 lines
987 B
Ruby

module Mutant
class Subject
# Abstract base class for method subjects
class Method < self
# Method name
#
# @return [Expression]
#
# @api private
def name
node.children.fetch(self.class::NAME_INDEX)
end
# Match expression
#
# @return [String]
#
# @api private
def expression
Expression::Method.new(
scope_symbol: self.class::SYMBOL,
scope_name: scope.name,
method_name: name.to_s
)
end
memoize :expression
# Match expressions
#
# @return [Array<Expression>]
#
# @api private
def match_expressions
[expression].concat(context.match_expressions)
end
memoize :match_expressions
private
# The scope
#
# @return [Class, Module]
#
# @api private
def scope
context.scope
end
end # Method
end # Subject
end # Mutant