From 84bfea0357dcfe8eb09d14198a76d3cdf14e658f Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Fri, 19 Apr 2013 23:36:49 +0200 Subject: [PATCH] Cleanup namespace matcher --- lib/mutant/matcher/namespace.rb | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/lib/mutant/matcher/namespace.rb b/lib/mutant/matcher/namespace.rb index b96d42a5..7b300c0f 100644 --- a/lib/mutant/matcher/namespace.rb +++ b/lib/mutant/matcher/namespace.rb @@ -2,7 +2,9 @@ module Mutant class Matcher # Matcher for specific namespace class Namespace < self - include Equalizer.new(:pattern) + include Concord.new(:namespace) + + MATCHERS = [Matcher::Methods::Singleton, Matcher::Methods::Instance] # Enumerate subjects # @@ -24,30 +26,8 @@ module Mutant self end - # Return namespace - # - # @return [Class::Module] - # - # @api private - # - attr_reader :namespace - - MATCHERS = [Matcher::Methods::Singleton, Matcher::Methods::Instance] - private - # Initialize object space matcher - # - # @param [Class, Module] namespace - # - # @return [undefined] - # - # @api private - # - def initialize(namespace) - @namespace = namespace - end - # Return pattern # # @return [Regexp] @@ -55,13 +35,13 @@ module Mutant # @api private # def pattern - %r(\A#{Regexp.escape(namespace.name)}(?:::)?\z) + %r(\A#{Regexp.escape(namespace.name)}(?:::)?) end memoize :pattern # Yield matchers for scope # - # @param [::Class,::Module] scope + # @param [Class,Module] scope # # @return [undefined] #