Class: EMDirWatcher::NameGlobMatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(glob) ⇒ NameGlobMatcher

Returns a new instance of NameGlobMatcher.



132
133
134
# File 'lib/em-dir-watcher/tree.rb', line 132

def initialize glob
  @glob = glob
end

Instance Method Details

#matches?(relative_path) ⇒ Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/em-dir-watcher/tree.rb', line 135

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