Class: Insika::Harvest::Criterion
- Inherits:
-
Object
- Object
- Insika::Harvest::Criterion
- Defined in:
- lib/insika/harvest/criterion.rb
Overview
C4 — the frozen conversion criterion, parsed from the deployment's
criterion file. The parity shape (Parity::Criterion) copied: one
file, one ```yaml fence, the WHOLE bytes hashed (an edit to the rationale
invalidates the frozen rule too), strict keys, no defaults. A skill may
land only when the store's ruler is not measurably worse than the
accepted state — the FILE is the criterion; a profile carries no
thresholds, and GateHarvest/PromoteHarvest receive the loaded
criterion (with its sha) at boot.
Defined Under Namespace
Classes: Rule
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
Class Method Summary collapse
-
.load(path) ⇒ Object
Reads the file, extracts the FIRST ```yaml fence, validates STRICTLY.
Instance Method Summary collapse
-
#initialize(rule:, path:, sha:) ⇒ Criterion
constructor
A new instance of Criterion.
- #to_h ⇒ Object
Constructor Details
#initialize(rule:, path:, sha:) ⇒ Criterion
Returns a new instance of Criterion.
21 22 23 24 25 |
# File 'lib/insika/harvest/criterion.rb', line 21 def initialize(rule:, path:, sha:) @rule = rule @path = path @sha = sha end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
19 20 21 |
# File 'lib/insika/harvest/criterion.rb', line 19 def path @path end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
19 20 21 |
# File 'lib/insika/harvest/criterion.rb', line 19 def rule @rule end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
19 20 21 |
# File 'lib/insika/harvest/criterion.rb', line 19 def sha @sha end |
Class Method Details
.load(path) ⇒ Object
Reads the file, extracts the FIRST ```yaml fence, validates STRICTLY. Raises Insika::ConfigError when the file is absent or has no block; Insika::ValidationError on an unknown or missing key, or a malformed value — every defect named.
31 32 33 34 35 36 37 |
# File 'lib/insika/harvest/criterion.rb', line 31 def self.load(path) bytes = read_bytes(path) block = extract_yaml_block(bytes) parsed = YAML.safe_load(block, permitted_classes: [], aliases: false) rule = build_rule(parsed) new(rule: rule, path: path, sha: "sha256:#{Digest::SHA256.hexdigest(bytes)}") end |
Instance Method Details
#to_h ⇒ Object
39 |
# File 'lib/insika/harvest/criterion.rb', line 39 def to_h = @rule.to_h |