Class: Git::Conform::FileChecker
Class Attribute Summary collapse
Attributes inherited from BaseChecker
#filename
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseChecker
#check_conformity, #check_exclusion, #initialize
Class Attribute Details
.file_exclusion_patterns ⇒ Object
Returns the value of attribute file_exclusion_patterns.
9
10
11
|
# File 'lib/git/conform/checkers/file_checker.rb', line 9
def file_exclusion_patterns
@file_exclusion_patterns
end
|
Class Method Details
.available_checkers ⇒ Object
42
43
44
45
46
|
# File 'lib/git/conform/checkers/file_checker.rb', line 42
def self.available_checkers
@available_checkers.map(&:name).map { |class_name|
class_name.match(/\AGit::Conform::(.*Checker)\Z/)[1]
}
end
|
.excluded?(filename) ⇒ Boolean
11
12
13
14
15
|
# File 'lib/git/conform/checkers/file_checker.rb', line 11
def excluded?(filename)
file_exclusion_patterns.any? { |pattern|
File.fnmatch?(pattern, filename)
}
end
|
.inherited(subclass) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/git/conform/checkers/file_checker.rb', line 33
def self.inherited(subclass)
@available_checkers << subclass
subclass.instance_variable_set(:@file_exclusion_patterns, @file_exclusion_patterns.dup)
end
|
Instance Method Details
23
24
25
|
# File 'lib/git/conform/checkers/file_checker.rb', line 23
def conforms?
true
end
|
#content ⇒ Object
27
28
29
|
# File 'lib/git/conform/checkers/file_checker.rb', line 27
def content
File.read(@filename)
end
|
#excluded? ⇒ Boolean
19
20
21
|
# File 'lib/git/conform/checkers/file_checker.rb', line 19
def excluded?
self.class.excluded? @filename
end
|