free_mutant/lib/mutant/subject/method.rb
Markus Schirp 8335cccafb Fix YARD summary line
* Reduce redunrant 'Return' prefix on summaries
* Improve summary line to reflect the semantics of operation better
2015-07-03 15:21:39 +00:00

59 lines
1.1 KiB
Ruby

module Mutant
class Subject
# Abstract base class for method subjects
class Method < self
# Test if method is public
#
# @return [Boolean]
#
# @api private
abstract_method :public?
# 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