class
Ignore::File
- Ignore::File
- Reference
- Object
Overview
Represents an ignore file (like .gitignore) that can be read, modified, and saved
Included Modules
- Enumerable(String)
Defined in:
ignore/file.crConstructors
-
.new(path : String, create : Bool = true)
Initialize from a file path By default, creates empty if file doesn't exist Set create: false to raise if file doesn't exist
Instance Method Summary
-
#add(pattern : String) : self
Add a pattern (appends to end)
-
#clear : self
Remove all lines (patterns, comments, and blanks)
-
#each(& : String -> ) : Nil
Iterate over pattern strings (Enumerable support)
-
#empty? : Bool
Check if there are no patterns
-
#ignores?(path : String) : Bool
Check if a path should be ignored
-
#includes?(pattern : String) : Bool
Check if a pattern exists
-
#lines : Array(String)
All lines including comments and blank lines
-
#path : String
The file path
-
#patterns : Array(String)
Only pattern lines (excludes comments and blank lines)
-
#reload : self
Reload from disk (discards unsaved changes)
-
#remove(pattern : String) : self
Remove a pattern (first occurrence)
-
#save(path : String = @path) : self
Save to file (original path or specified path)
-
#size : Int32
Number of patterns (excludes comments and blank lines)
Constructor Detail
Initialize from a file path By default, creates empty if file doesn't exist Set create: false to raise if file doesn't exist