Module: CompletionKit::Checks::Registry

Defined in:
app/services/completion_kit/checks/registry.rb

Constant Summary collapse

CHECKS =
{
  "contains" => Contains,
  "not_contains" => NotContains,
  "equals" => Equals,
  "regex" => Regex,
  "valid_json" => ValidJson,
  "json_path_equals" => JsonPathEquals,
  "length_bounds" => LengthBounds,
  "no_refusal" => NoRefusal
}.freeze
REQUIRED_KEYS =
{
  "contains" => %w[value],
  "not_contains" => %w[value],
  "equals" => %w[value],
  "regex" => %w[pattern],
  "valid_json" => [],
  "json_path_equals" => %w[json_path expected],
  "length_bounds" => [],
  "no_refusal" => []
}.freeze
KINDS =
CHECKS.keys.freeze

Class Method Summary collapse

Class Method Details

.fetch(kind) ⇒ Object



36
37
38
# File 'app/services/completion_kit/checks/registry.rb', line 36

def self.fetch(kind)
  CHECKS.fetch(kind).new
end

.kindsObject



28
29
30
# File 'app/services/completion_kit/checks/registry.rb', line 28

def self.kinds
  KINDS
end

.required_keysObject



32
33
34
# File 'app/services/completion_kit/checks/registry.rb', line 32

def self.required_keys
  REQUIRED_KEYS
end