class Mutest::Matcher::Methods

Abstract base class for matcher that returns method subjects from scope

Constants

CANDIDATE_NAMES

Public Instance Methods

call(env) click to toggle source

Enumerate subjects

@param [Env::Bootstrap] env

@return [Enumerable<Subject>]

# File lib/mutest/matcher/methods.rb, line 21
def call(env)
  Chain.new(
    methods.map { |method| matcher.new(scope, method) }
  ).call(env)
end

Private Instance Methods

candidate_names() click to toggle source

Candidate method names on target scope

@return [Enumerable<Symbol>]

# File lib/mutest/matcher/methods.rb, line 50
def candidate_names
  CANDIDATE_NAMES
    .map(&candidate_scope.method(:public_send))
    .reduce(:+)
    .sort
end
matcher() click to toggle source

method matcher class

@return [Class] Matcher::Method

# File lib/mutest/matcher/methods.rb, line 32
def matcher
  self.class::MATCHER
end
methods() click to toggle source

Available methods scope

@return [Enumerable<Method, UnboundMethod>]

# File lib/mutest/matcher/methods.rb, line 39
def methods
  candidate_names.each_with_object([]) do |name, methods|
    method = access(name)
    methods << method if method.owner.equal?(candidate_scope)
  end
end