def match(dirname, basename)
        # Potential `entries` syscall
        matches = @entries[dirname]

        pattern = @patterns[basename]
        matches = matches.select { |m| m =~ pattern }

        sort_matches(matches, basename).each do |path|
          filename = File.join(dirname, path)

          # Potential `stat` syscall
          stat = @stats[filename]

          # Exclude directories
          if stat && stat.file?
            yield filename
          end
        end
      end
def match(dirname, basename)
        # Potential `entries` syscall
        matches = @entries[dirname]

        pattern = @patterns[basename]
        matches = matches.select { |m| m =~ pattern }

        sort_matches(matches, basename).each do |path|
          filename = File.join(dirname, path)

          # Potential `stat` syscall
          stat = @stats[filename]

          # Exclude directories
          if stat && stat.file?
            yield filename
          end
        end
      end
Checks if the path is actually on the file system and performs
 any syscalls if necessary.