class

Ignore::File

Inherits Enumerable < Reference < Object

Represents an ignore file (like .gitignore) that can be read, modified, and saved

Constructors

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

Source

Instance methods

add(pattern : String) : self

Add a pattern (appends to end)

Source
clear

Remove all lines (patterns, comments, and blanks)

Source
each

Iterate over pattern strings (Enumerable support)

Source
empty?

Check if there are no patterns

Source
ignores?(path : String) : Bool

Check if a path should be ignored

Source
includes?(pattern : String) : Bool

Check if a pattern exists

Source
lines

All lines including comments and blank lines

Source
path

The file path

Source
patterns

Only pattern lines (excludes comments and blank lines)

Source
reload

Reload from disk (discards unsaved changes)

Source
remove(pattern : String) : self

Remove a pattern (first occurrence)

Source
save(path : String = @path) : self

Save to file (original path or specified path)

Source
size

Number of patterns (excludes comments and blank lines)

Source