Class: Policial::StyleGuides::Base
- Inherits:
-
Object
- Object
- Policial::StyleGuides::Base
show all
- Defined in:
- lib/policial/style_guides/base.rb
Overview
Public: Base to contain common style guide logic.
Instance Method Summary
collapse
Constructor Details
#initialize(config_loader, options = {}) ⇒ Base
Returns a new instance of Base.
7
8
9
10
|
# File 'lib/policial/style_guides/base.rb', line 7
def initialize(config_loader, options = {})
@config_loader = config_loader
@options = options
end
|
Instance Method Details
#config_file ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/policial/style_guides/base.rb', line 28
def config_file
if @options[:config_file].to_s.strip.empty?
default_config_file
else
@options[:config_file]
end
end
|
#default_config_file ⇒ Object
24
25
26
|
# File 'lib/policial/style_guides/base.rb', line 24
def default_config_file
raise NotImplementedError, "must implement ##{__method__}"
end
|
#exclude_file?(_filename) ⇒ Boolean
16
17
18
|
# File 'lib/policial/style_guides/base.rb', line 16
def exclude_file?(_filename)
raise NotImplementedError, "must implement ##{__method__}"
end
|
#filename_pattern ⇒ Object
20
21
22
|
# File 'lib/policial/style_guides/base.rb', line 20
def filename_pattern
raise NotImplementedError, "must implement ##{__method__}"
end
|
#investigate?(filename) ⇒ Boolean
36
37
38
|
# File 'lib/policial/style_guides/base.rb', line 36
def investigate?(filename)
enabled? && matches_pattern?(filename) && !exclude_file?(filename)
end
|
#violations_in_file(_file) ⇒ Object
12
13
14
|
# File 'lib/policial/style_guides/base.rb', line 12
def violations_in_file(_file)
raise NotImplementedError, "must implement ##{__method__}"
end
|