free_mutant/lib/mutant/subject/method.rb

50 lines
854 B
Ruby
Raw Normal View History

2013-01-13 16:25:49 -05:00
module Mutant
class Subject
# Abstract base class for method subjects
class Method < self
# Test if method is public
#
2014-06-15 15:27:57 -04:00
# @return [Boolean]
2013-01-13 16:25:49 -05:00
#
# @api private
#
abstract_method :public?
# Return method name
#
# @return [Symbol]
#
# @api private
#
def name
node.children[self.class::NAME_INDEX]
end
2013-06-14 14:23:46 -04:00
# Return match expression
#
# @return [String]
#
# @api private
#
def expression
Expression.parse("#{context.identification}#{self.class::SYMBOL}#{name}")
end
memoize :expression
private
# Return scope
#
# @return [Class, Module]
#
# @api private
#
def scope
context.scope
end
2013-06-14 14:23:46 -04:00
end # Method
end # Subject
end # Mutant