def select_matching_file_patterns(patterns, path)
      patterns.select do |pattern|
        if pattern.is_a?(Regexp)
          path.to_s.match(pattern)
        else
          flags = File::FNM_PATHNAME
          flags |= File::FNM_DOTMATCH if include_hidden_files?
          File.fnmatch(pattern, path, flags)
        end
      end
    end
def select_matching_file_patterns(patterns, path)
      patterns.select do |pattern|
        if pattern.is_a?(Regexp)
          path.to_s.match(pattern)
        else
          flags = File::FNM_PATHNAME
          flags |= File::FNM_DOTMATCH if include_hidden_files?
          File.fnmatch(pattern, path, flags)
        end
      end
    end
@!group Helpers
 Select elements in an enumerable which match the given path.

 @param  [Enumerable<String|RegExp>] patterns
         The patterns to check

 @param  [Pathname] path
         The file to match

 @return [Enumerable<String|RegExp>]