Class: RosettAi::Policy::ProtectedFiles
- Inherits:
-
Object
- Object
- RosettAi::Policy::ProtectedFiles
- Defined in:
- lib/rosett_ai/policy/protected_files.rb
Overview
Manages the list of files that AI tools may read but not modify.
Protected files are compiled to engine-specific read-only annotations. Human override requires an explicit waiver in the policy configuration.
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
-
#empty? ⇒ Boolean
True if no files protected.
-
#initialize(paths: []) ⇒ ProtectedFiles
constructor
A new instance of ProtectedFiles.
-
#merge(other) ⇒ ProtectedFiles
Merges another protected files list (union of paths).
-
#protected?(path) ⇒ Boolean
Tests whether a file path is protected (read-only for AI).
-
#size ⇒ Integer
Number of protected files.
Constructor Details
#initialize(paths: []) ⇒ ProtectedFiles
Returns a new instance of ProtectedFiles.
16 17 18 |
# File 'lib/rosett_ai/policy/protected_files.rb', line 16 def initialize(paths: []) @paths = paths.map(&:freeze).freeze end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
13 14 15 |
# File 'lib/rosett_ai/policy/protected_files.rb', line 13 def paths @paths end |
Instance Method Details
#empty? ⇒ Boolean
Returns true if no files protected.
42 43 44 |
# File 'lib/rosett_ai/policy/protected_files.rb', line 42 def empty? @paths.empty? end |
#merge(other) ⇒ ProtectedFiles
Merges another protected files list (union of paths).
32 33 34 |
# File 'lib/rosett_ai/policy/protected_files.rb', line 32 def merge(other) self.class.new(paths: (@paths + other.paths).uniq) end |
#protected?(path) ⇒ Boolean
Tests whether a file path is protected (read-only for AI).
24 25 26 |
# File 'lib/rosett_ai/policy/protected_files.rb', line 24 def protected?(path) @paths.include?(path) end |
#size ⇒ Integer
Returns number of protected files.
37 38 39 |
# File 'lib/rosett_ai/policy/protected_files.rb', line 37 def size @paths.size end |