Class: OllamaAgent::Security::OwnershipCompiler
- Inherits:
-
Object
- Object
- OllamaAgent::Security::OwnershipCompiler
- Defined in:
- lib/ollama_agent/security/ownership_compiler.rb
Overview
Parses and validates owners rules, then builds an OwnershipIndex.
Instance Method Summary collapse
- #compile(yaml_string: nil, path: nil) ⇒ OwnershipIndex
-
#source_sha256 ⇒ String
Hex SHA256 of the last compiled source bytes.
Instance Method Details
#compile(yaml_string: nil, path: nil) ⇒ OwnershipIndex
17 18 19 20 21 22 23 |
# File 'lib/ollama_agent/security/ownership_compiler.rb', line 17 def compile(yaml_string: nil, path: nil) @source_bytes = read_source(yaml_string: yaml_string, path: path) rules = rules_from_tree(parse_yaml(@source_bytes)) flat = OwnershipRuleTreeFlattener.new.flatten(rules) OwnershipCompileValidators.validate!(flat) index_from_flat(flat) end |
#source_sha256 ⇒ String
Returns hex SHA256 of the last compiled source bytes.
26 27 28 29 30 |
# File 'lib/ollama_agent/security/ownership_compiler.rb', line 26 def source_sha256 raise OwnershipCompileError, "compile first" unless @source_bytes Digest::SHA256.hexdigest(@source_bytes) end |