Class: RosettAi::Policy::OptOutScanner
- Inherits:
-
Object
- Object
- RosettAi::Policy::OptOutScanner
- Defined in:
- lib/rosett_ai/policy/opt_out_scanner.rb
Overview
Scans files for AI-MODIFICATION opt-out markers.
Files containing # AI-MODIFICATION: disabled are added to the
protected files list during compilation.
Constant Summary collapse
- MARKER =
Returns File marker for AI opt-out declarations.
'AI-MODIFICATION: disabled'
Instance Method Summary collapse
-
#opted_out?(path) ⇒ Boolean
Scans a single file for opt-out markers.
-
#scan(paths) ⇒ Array<String>
Scans multiple files and returns those with opt-out markers.
Instance Method Details
#opted_out?(path) ⇒ Boolean
Scans a single file for opt-out markers.
20 21 22 23 24 25 26 27 |
# File 'lib/rosett_ai/policy/opt_out_scanner.rb', line 20 def opted_out?(path) return false unless File.exist?(path) return false unless File.readable?(path) File.foreach(path).any? { |line| line.include?(MARKER) } rescue StandardError false end |
#scan(paths) ⇒ Array<String>
Scans multiple files and returns those with opt-out markers.
33 34 35 |
# File 'lib/rosett_ai/policy/opt_out_scanner.rb', line 33 def scan(paths) paths.select { |path| opted_out?(path) } end |