Class: EMDirWatcher::PathGlobMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/em-dir-watcher/tree.rb

Instance Method Summary collapse

Constructor Details

#initialize(glob) ⇒ PathGlobMatcher

Returns a new instance of PathGlobMatcher.



123
124
125
# File 'lib/em-dir-watcher/tree.rb', line 123

def initialize glob
  @glob = glob.gsub(%r-^/+-, '')
end

Instance Method Details

#matches?(relative_path) ⇒ Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/em-dir-watcher/tree.rb', line 126

def matches? relative_path
  File.fnmatch?(@glob, relative_path)
end