Class: Mutant::Matcher::Namespace

Inherits:
Mutant::Matcher show all
Defined in:
lib/mutant/matcher/namespace.rb

Overview

Matcher for specific namespace

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mutant::Matcher

build, each, #identification

Class Method Details

.scope_name(scope) ⇒ String?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return scope name

Parameters:

  • scope (Class, Module)

Returns:

  • (String)

    if scope has a name and does not raise exceptions optaining it

  • (nil)

    otherwise



69
70
71
72
73
74
75
76
77
78
# File 'lib/mutant/matcher/namespace.rb', line 69

def self.scope_name(scope)
  scope.name
rescue => exception
  $stderr.puts <<-MESSAGE
WARNING:
While optaining #{scope.class}#name from: #{scope.inspect}
It raised an error: #{exception.inspect} fix your lib!
  MESSAGE
  nil
end

Instance Method Details

#each(&block) ⇒ self, Enumerator<Subject>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Enumerate subjects

Returns:

  • (self)

    if block given

  • (Enumerator<Subject>)

    otherwise



20
21
22
23
24
25
26
27
28
# File 'lib/mutant/matcher/namespace.rb', line 20

def each(&block)
  return to_enum unless block_given?

  scopes.each do |scope|
    Scope.each(cache, scope, &block)
  end

  self
end