Dragonite.Parser.to_rules
You're seeing just the function
to_rules
, go back to Dragonite.Parser module for more information.
Specs
to_rules( %DragoniteEDI.Message{iea: term(), isa: term(), sts: term()}, integer(), [String.t()] ) :: {:ok, %DragoniteEDI.Message{iea: term(), isa: term(), sts: term()}} | {:error, {:rules_not_passed, list()}}
Check if a %DragoniteEDI.Message{}
is valid against rules defined in environment, so
dont need to pass rules, since they are loaded from pre-loaded config. If rules are empty the message is marked as valid, since there are no rules to check. The function returns either the message or an error containing the validation that breaks the rules. To work with wildcards just pass the wildcard as an enumerable of one struct: ``` Dragonite.Parser.to_rules(%DragoniteEDI.Message{}, 204, [%MyStruct{qualifier: "Q1"}]) ``` After that definitions in YML against
$custom.?` will run extracting the value
from custom struct provided.
## Example
iex(1)> Dragonite.Parser.to_rules(%DragoniteEDI.Message{}, 204)