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.



63
64
65
# File 'lib/loom/pattern/expanding_reference.rb', line 63

def initialize(loom_pattern_slug)
  @my_slug = loom_pattern_slug
end

Class Method Details

.get_matcher(slug) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/loom/pattern/expanding_reference.rb', line 54

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

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