Class: Loom::Pattern::ExpandingReference::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/loom/pattern/expanding_reference.rb

Overview

TODO: This can be made common to some utility directory if one emerges.

Defined Under Namespace

Modules: EqualityMatcher, GlobMatcher

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loom_pattern_slug) ⇒ Matcher

Returns a new instance of Matcher.



60
61
62
# File 'lib/loom/pattern/expanding_reference.rb', line 60

def initialize(loom_pattern_slug)
  @my_slug = loom_pattern_slug
end

Class Method Details

.get_matcher(slug) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/loom/pattern/expanding_reference.rb', line 51

def self.get_matcher(slug)
  matcher_module = [
    GlobMatcher,
    EqualityMatcher
  ].first { |m| m.handles_pattern? slug }

  Class.new(Matcher).include(matcher_module).new(slug)
end