class Ignore::Dir

Overview

A directory wrapper that filters results using gitignore patterns

Included Modules

Defined in:

ignore/dir.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(path : String, patterns : Enumerable(String)) #

Initialize with path and enumerable of patterns


def self.new(path : String, matcher : Matcher) #

Initialize with path and existing matcher


def self.new(path : String, *patterns : String) #

Initialize with path and pattern strings


def self.new(path : String, *, root : String) #

Initialize with path, loading patterns from ignore files in tree


def self.new(path : String, *, file : String, base : String = "") #

Initialize with path, loading patterns from a single file


Instance Method Detail

def add(pattern : String) : self #

Add additional patterns


def children : Array(String) #

Returns children of base directory, filtered


def each(& : String -> ) : Nil #

Iterate over children, filtered (Enumerable support)


def each_child(& : String -> ) : Nil #

Iterate over children, filtered


def each_ignored_child(& : String -> ) : Nil #

Iterate over only ignored children


def entries : Array(String) #

Returns entries of base directory (includes . and ..), filtered


def glob(pattern : String, *, match : ::File::MatchOptions = ::File::MatchOptions::None) : Array(String) #

Glob with filtering, returns array


def glob(pattern : String, *, match : ::File::MatchOptions = ::File::MatchOptions::None, &block : String -> ) : Nil #

Glob with filtering, yields each match


def ignored_children : Array(String) #

Returns only ignored children of base directory


def ignored_entries : Array(String) #

Returns only ignored entries of base directory (excludes . and ..)


def ignored_glob(pattern : String, *, match : ::File::MatchOptions = ::File::MatchOptions::None) : Array(String) #

Glob returning only ignored paths


def ignored_glob(pattern : String, *, match : ::File::MatchOptions = ::File::MatchOptions::None, &block : String -> ) : Nil #

Glob returning only ignored paths, yields each match


def ignores?(path : String) : Bool #

Check if a path should be ignored


def path : String #

The base path