Module: Loom::Pattern::ExpandingReference::Matcher::GlobMatcher

Defined in:
lib/loom/pattern/expanding_reference.rb

Constant Summary collapse

MATCH_P =
/(\*)$/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handles_pattern?(my_slug) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
71
72
# File 'lib/loom/pattern/expanding_reference.rb', line 68

def self.handles_pattern?(my_slug)
  res = my_slug.match? MATCH_P
  Loom.log.debug2(self) { "#{p}.match? #{MATCH_P} = #{res}" }
  res
end

Instance Method Details

#match?(your_pattern) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
77
78
# File 'lib/loom/pattern/expanding_reference.rb', line 74

def match?(your_pattern)
  prefix = @my_slug.to_s.gsub(MATCH_P, "")
  Loom.log.debug2(self) { "GlobMatcher+match?+ #{@my_slug} #{your_pattern}, prefix: #{prefix}"}
  your_pattern.to_s.start_with? prefix
end