Class: Sanctify::Scanner
- Inherits:
-
Object
- Object
- Sanctify::Scanner
- Defined in:
- lib/sanctify/scanner.rb
Instance Attribute Summary collapse
-
#matcher_list ⇒ Object
readonly
Returns the value of attribute matcher_list.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(args) ⇒ Scanner
constructor
A new instance of Scanner.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Scanner
Returns a new instance of Scanner.
8 9 10 11 12 13 14 |
# File 'lib/sanctify/scanner.rb', line 8 def initialize(args) config = args[:config] || {} @repo = Repo.new(args, ignored_paths: config['ignored_paths']) @matcher_list = MatcherList.new( custom_matchers: config['custom_matchers'], disabled_matchers: config['disabled_matchers']) end |
Instance Attribute Details
#matcher_list ⇒ Object (readonly)
Returns the value of attribute matcher_list.
7 8 9 |
# File 'lib/sanctify/scanner.rb', line 7 def matcher_list @matcher_list end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/sanctify/scanner.rb', line 7 def repo @repo end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sanctify/scanner.rb', line 16 def run repo.added_lines.each do |line, path| matcher_list.each do |matcher| next if matcher.disabled? if matcher.regex.match(line) raise ScannerError, (matcher, line, path) end end end end |