class Guard::Watcher::Pattern::Matcher

Public Class Methods

new(obj) click to toggle source
# File lib/guard/watcher/pattern/matcher.rb, line 5
def initialize(obj)
  @matcher = obj
end

Public Instance Methods

match(string_or_pathname) click to toggle source
# File lib/guard/watcher/pattern/matcher.rb, line 9
def match(string_or_pathname)
  @matcher.match(normalized(string_or_pathname))
end

Private Instance Methods

normalized(string_or_pathname) click to toggle source
# File lib/guard/watcher/pattern/matcher.rb, line 15
def normalized(string_or_pathname)
  path = Pathname.new(string_or_pathname).cleanpath
  return path.to_s if @matcher.is_a?(Regexp)
  path
end