Class: ActiveMutator::SubjectMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/active_mutator/subject_matcher.rb

Overview

Tiny subject-expression grammar for --subject:

Foo::Bar#baz  exact          Foo::Bar   all methods of the constant
Foo::Bar*     namespace      Foo::Bar#* instance-only   Foo::Bar.* singleton-only

Instance Method Summary collapse

Constructor Details

#initialize(expression) ⇒ SubjectMatcher

Returns a new instance of SubjectMatcher.



6
7
8
# File 'lib/active_mutator/subject_matcher.rb', line 6

def initialize(expression)
  @regexp = compile(expression)
end

Instance Method Details

#match?(name) ⇒ Boolean

Returns:

  • (Boolean)


10
# File 'lib/active_mutator/subject_matcher.rb', line 10

def match?(name) = @regexp.match?(name)