Sha256: d3b8bd0277718c7dc6ff57caa6663e3b69599c46771348305ed6764c3a3981c8
Contents?: true
Size: 712 Bytes
Versions: 3
Compression:
Stored size: 712 Bytes
Contents
module Todoloo module Helpers extend self # Returns an `Enumerator` over the paths that match `pattern` # # TODO We need to optimize how we traverse the file-system so that we can short-circuit the excludes instead # of only filtering after finding them. # # @pattern [String] # The file paths to glob # # @excludes [Array<String>] # Optional list of file globs to exclude from the enumeration # # @return [Enumerator<String>] def glob_paths(pattern, excludes: []) Enumerator.new do |y| Dir[pattern].lazy.each do |path| y << path unless excludes.any? { |e| File.fnmatch(e, path) } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
todoloo-0.0.3 | lib/todoloo/helpers.rb |
todoloo-0.0.2 | lib/todoloo/helpers.rb |
todoloo-0.0.1 | lib/todoloo/helpers.rb |