Class: Kompo::KompoIgnore
- Inherits:
-
Object
- Object
- Kompo::KompoIgnore
- Defined in:
- lib/kompo/kompo_ignore.rb
Overview
Handler for .kompoignore file Uses pathspec gem for gitignore-compatible pattern matching
Constant Summary collapse
- FILENAME =
".kompoignore"
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Check if .kompoignore file exists and is enabled.
-
#ignore?(relative_path) ⇒ Boolean
Check if the given relative path should be ignored.
-
#initialize(project_dir) ⇒ KompoIgnore
constructor
A new instance of KompoIgnore.
Constructor Details
#initialize(project_dir) ⇒ KompoIgnore
Returns a new instance of KompoIgnore.
11 12 13 14 |
# File 'lib/kompo/kompo_ignore.rb', line 11 def initialize(project_dir) @project_dir = project_dir @pathspec = load_pathspec end |
Instance Method Details
#enabled? ⇒ Boolean
Check if .kompoignore file exists and is enabled
27 28 29 |
# File 'lib/kompo/kompo_ignore.rb', line 27 def enabled? !@pathspec.nil? end |
#ignore?(relative_path) ⇒ Boolean
Check if the given relative path should be ignored
19 20 21 22 23 |
# File 'lib/kompo/kompo_ignore.rb', line 19 def ignore?(relative_path) return false unless @pathspec @pathspec.match(relative_path) end |