Class GuardrailFiles
- Namespace
- IntentSharp.Guardrails
- Assembly
- IntentSharp.Guardrails.dll
Reads rule files from text, with the same binder DocumentGuardrailSource uses: to test a rule file in a unit test, or to keep rule files in a store of your own and serve them through an IGuardrailSource you write. No manifest is needed: every document given is read.
public static class GuardrailFiles
- Inheritance
-
objectGuardrailFiles
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()object.ReferenceEquals(object, object)object.ToString()
Methods
- Parse(IReadOnlyList<KeyValuePair<string, string>>, GuardrailSourceOptions?)
Reads rule files and compiled companions. Each document is a path and its text: a path ending in
.rules.json,.rules.yamlor.rules.ymlis a rule file, one ending in.rules.compiled.jsonis the companion of the rule file whose path it derives from, and its rules follow that set's own. A document with any problem adds nothing. A set name defined by two documents is served asrules.ambiguousSetin CodeSettings says: by neither, with a problem that names both (serveNeither, the default), or by the document given first (firstWins). Never throws for content.
- ParseOrThrow(IReadOnlyList<KeyValuePair<string, string>>, GuardrailSourceOptions?)
Reads rule files and compiled companions as Parse(IReadOnlyList<KeyValuePair<string, string>>, GuardrailSourceOptions?) does, and throws when any document has a problem, so a test fails with every
path:line: messagein one message.