Class: RubyLLM::Contract::SchemaValidator::ScalarRules

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/contract/contract/schema_validator/scalar_rules.rb

Overview

Applies scalar-only validation rules to a schema node.

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ScalarRules

Returns a new instance of ScalarRules.



8
9
10
11
12
13
14
# File 'lib/ruby_llm/contract/contract/schema_validator/scalar_rules.rb', line 8

def initialize(errors)
  @rules = [
    TypeRule.new(errors),
    EnumRule.new(errors),
    BoundRule.new(errors)
  ]
end

Instance Method Details

#validate(node) ⇒ Object



16
17
18
# File 'lib/ruby_llm/contract/contract/schema_validator/scalar_rules.rb', line 16

def validate(node)
  @rules.each { |rule| rule.validate(node) }
end