Class: Lutaml::Model::Validation::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/validation/rule.rb

Overview

Abstract base class for validation rules. Subclass and override #code, #category, #severity, #applicable?, and #check to implement domain-specific validation logic.

Use the private #issue helper inside #check to create issues that inherit the rule’s severity and code by default.

Instance Method Summary collapse

Instance Method Details

#applicable?(_context) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/lutaml/model/validation/rule.rb', line 25

def applicable?(_context)
  true
end

#categoryObject



17
18
19
# File 'lib/lutaml/model/validation/rule.rb', line 17

def category
  :general
end

#check(_context) ⇒ Object



29
30
31
# File 'lib/lutaml/model/validation/rule.rb', line 29

def check(_context)
  []
end

#codeObject



13
14
15
# File 'lib/lutaml/model/validation/rule.rb', line 13

def code
  nil
end

#collect(_element, _context) ⇒ Object



37
# File 'lib/lutaml/model/validation/rule.rb', line 37

def collect(_element, _context); end

#complete(_context) ⇒ Object



39
40
41
# File 'lib/lutaml/model/validation/rule.rb', line 39

def complete(_context)
  []
end

#needs_deferred?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/lutaml/model/validation/rule.rb', line 33

def needs_deferred?
  false
end

#severityObject



21
22
23
# File 'lib/lutaml/model/validation/rule.rb', line 21

def severity
  "error"
end