The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Kvasir::Rule::InputUnderThreshold - Generic rule for checking input thresholds

SYNOPSIS

  use Kvasir::Declare;
  
  my $engine = engine {
      rule 'valid_name' => instanceof Kvasir::Rule::InputUnderThreshold => with_args {
          'input_1' => 5,
          'input_2' => -5,
      }
  }
  

DESCRIPTION

This is a generic rule that checks if the value from an input is does not pass a threshold relative to 0. This can be used to model change matrices where a row represets a rule.

The following table shows the conditions when it matches

  Input | Threshold | Result
  ------+-----------+-------
  x     | 0         | match
  > y   | y > 0     | no match
  > y   | y < 0     | match 
  < y   | y < 0     | no match
  < y   | y > 0     | match
    

USAGE

Rule arguments

This rule expects a hash reference as its argument, which is what with_args provides, where the key is the name of an input and the value is the expected threshold value.